【发布时间】:2013-11-30 09:50:56
【问题描述】:
在我的 android 应用程序中,我在 tableLayout 中有一个可展开的列表视图和一个按钮,但我有一个问题,表格的宽度没有完全显示,我设置了 (android:layout_width="match_parent") 但它不起作用。另一方面,当我使用线性布局时,按钮隐藏在列表下(当我打开子列表时)。项目之间的某种重叠。我有 2 个项目。其中一个隐藏在另一个之下。我该如何解决?
我的代码是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/expandableListView"/>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/backup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BackUp"
android:clickable="true"/>
</TableRow>
</TableLayout>
</LinearLayout>
【问题讨论】:
标签: android android-linearlayout expandablelistview tablelayout