我的 Android 布局有问题。
我有一些组件(这里是 TableLayout,然后是 ListView)。我的滚动条仅与 ListView 关联,而不与 TableLayout 关联。由于我的 TableLayout 会变得更长,在这种情况下,我的 Listview 将无法读取。
如何为整个页面提供滚动条,而不仅仅是 ListView ?
我的代码:
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="77dp" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:layout_column="1"
android:text="@string/client"
android:width="100px" />
<TextView
android:id="@+id/client"
android:layout_column="2"
android:width="200px" />
</TableRow>
</TableLayout>
<ListView
android:id="@+id/lstPointsVerification"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" >
</ListView>
这是ListView每一行的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvDate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
style="@style/ListePrincipal"
/>
我如何纠正这种行为?
问候
最佳答案
您可以做一件事,即为 Header
部分(即 ListView
上方的部分)创建一个单独的布局,并将其添加到 ListView
使用ListView.addHeader(View);
。因此,在这种情况下,您的布局将随 ListView
一起滚动。
关于java - Android中整个布局的滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8741832/