私はレイアウトを持っています:ScrollView - > RelativeLayout - > TableLayout - > TableRow - > ListView。私はコンテンツに応じてListViewの高さをどのように変更できるのか分かりません。私はアダプタがありますが、ListViewの高さは変わりません。スクロール可能ではありませんが、そうである必要はありません。私は、ListViewをネストして使用することは悪いことですが、Column0の画像のソースは複数の変数(アダプタは不要)に依存するため、解決策は見当たりません。 ListViewの代わりにLinearLayoutを使用することはできません。なぜなら、アダプタが必要だからです。入れ子になったListViewの高さを調整する
例:私が持っていると思いますどのような
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1000dp"
android:orientation="vertical" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#000000"
android:showDividers="middle" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button0"
android:layout_width="100sp"
android:layout_height="100sp"
android:layout_marginLeft="10sp"
android:layout_marginTop="10sp" />
<ListView
android:id="@+id/listView0"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
'ListView'の高さに' match_parent'を使用しているようです... –
ListViewまたはTableRowの高さにmatch_parentまたはwrap_contentを使用すると、何も変更されません。私は手動で高さを設定することができます。 – adamsc
@adamscはこちらをご覧くださいhttp://blog.lovelyhq.com/setting-listview-height-depending-on-the-items/ –