更新时间:2023-01-25 14:31:04
我认为您需要一个简单的两栏式组织:
I think you need a simple, two-column organization:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<!-- stuff goes here that should appear above the scrolling areas -->
<ScrollView
android:id="@+id/left_side_scroller"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<!-- contents of left side go here -->
</ScrollView>
<ScrollView
android:id="@+id/right_side_scroller"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<!-- contents of right side go here -->
</ScrollView>
<!-- stuff goes here that should appear below the scrolling areas -->
</LinearLayout>
或者(也许更好)看起来您应该使用两个 ListView
元素而不是两个 ScrollView
元素.每个 ListView
将具有与上述 ScrollView
相同的布局参数.由于 ListView
在内部管理滚动,因此您根本不需要 ScrollView
.
Alternatively (and perhaps better) it looks like you should be using two ListView
elements instead of two ScrollView
elements. Each ListView
would have the same layout parameters as shown above for the ScrollView
. Since a ListView
manages scrolling internally, you then don't need ScrollView
at all.
此外,您可能希望整个布局填满屏幕,过滤器"和排序"元素始终位于底部.为了达到这个效果,顶层布局应该有 android:layout_height="fill_parent"
而不是 "wrap_content"
.此外,可滚动区域应该具有 android:layout_height="0dp"
和非零权重(他们已经这样做了).
Also, you probably want the entire layout to fill the screen, with the "filter" and "sort" elements always at the bottom. To achieve this effect,the top-level layout should have android:layout_height="fill_parent"
instead of "wrap_content"
. Also, the scrollable areas should have android:layout_height="0dp"
and a non-zero weight (which they already do).