【发布时间】:2011-07-26 20:27:32
【问题描述】:
我在 TableLayout 中有一个自定义列表适配器。这个 TableLayout 嵌套在一个 LinearLayout 中。
如果新的子视图被添加到列表中,列表适配器会扩展。当列表适配器的大小增加时,我希望 TableRow 的大小动态增加。当列表增长时,按钮被按下。
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
>
<LinearLayout">
<!-- Draw header + sub title -->
<LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" >
<TextView ></TextView>
<TextView ></TextView>
</LinearLayout>
<LinearLayout android:orientation="horizontal">
<ImageView />
<LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent"
android:layout_weight="1">
<TableLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1">
<TableRow android:id="@+id/tr1">
<CustomList android:id="@+id/mainview"
ndroid:layout_height="wrap_content" android:layout_width="wrap_content" />
</TableRow>
<TableRow android:layout_height="wrap_content"
android:layout_width="match_parent">
<Button android:layout_width="wrap_content" android:id="@+id/button1"
android:text="@string/buttonPrevious" android:layout_height="wrap_content">
</Button>
<Button android:layout_width="wrap_content" android:id="@+id/button2"
android:text="@string/buttonNext" android:layout_height="wrap_content"></Button>
</TableRow>
</TableLayout>
</LinearLayout>
<ImageView />
</LinearLayout>
</ScrollView>
我是否必须进行一些更改,例如更改自定义列表适配器中的布局膨胀方式或其他任何内容?
【问题讨论】:
-
Android ListView that does not scroll? 根据接受的答案复制。
标签: android android-listview listadapter