我有一个 LinearLayout
,其中有多个 TextView
,底部有一个 ListView
- 请参阅下面的代码。
问题是 TextView/CheckBox 占据了大约 75% 的屏幕 - ListView 在底部有一个滚动条,不能大量使用 - 如何禁用 ListView 滚动并启用整个 LinearLayout 滚动。请提供一些示例代码。
<LinearLayout android:orientation="vertical"
android:layout_margin="5dip"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout android:layout_width="fill_parent"
android:layout_margin="5dip"
android:layout_height="wrap_content"
android:background="#CCCCCC">
<TextView android:id="@+id/_text_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/text1"
android:layout_marginTop="14dip"
android:textColor="#FFFFFF"
android:gravity="center_horizontal"
android:textSize="17dip"
android:textStyle="bold" />
<CheckBox ..../>
<CheckBox ..../>
<TextView android:id="@+id/_text_title" ..../>
<CheckBox ..../>
<CheckBox ..../>
<ListView .../>
</LinearLayout>
最佳答案
切勿将一个可 ScrollView 放入另一个可 ScrollView 中。不起作用。如果你遇到这样的问题,那么说明你的 UI 设计存在缺陷。用户界面重新设计/重新思考迫在眉睫。
关于Android ListView和滚动问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4867938/