我有一个自定义列表视图,当单击其中一行时,它会改变大小,添加新行。当活动首次加载时,表格布局中只有一行和两个按钮(上一个和下一个)。目前,如果我将列表视图添加到 tablerow 并且第 2 行包含按钮。布局高度和宽度设置为 wrap_content。
当新行添加到列表视图时,行大小不会改变,然后会扩展以占据按钮的空间。因此,我的按钮消失了。
主要的.xml
<LinearLayout android:orientation="vertical" style="?fill_parent"
android:layout_weight="1">
<TableLayout style="?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>
将新行添加到视图时,如何动态更新行大小。?谢谢