我试图防止 ScrollView 在屏幕底部占用太多空间,因为它会阻止我的两个按钮显示。我也不想手动设置 ScrollView 的高度。
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
...
android:orientation="horizontal">
<Button .../>
<TextView .../>
<Button .../>
</LinearLayout>
<ScrollView
android:layout_width="math_parent"
android:layout_height="wrap_content">
<ImageView .../>
<ImageView .../>
<ImageView .../>
</ScrollView>
<LinearLayout
...
android:orientation="horizontal">
<Button .../>
<Button .../>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的布局的通用版本。发生的情况是,无论其中有多少项,ScrollView 都会一直延伸到屏幕底部。这会导致屏幕底部的两个按钮不可见。
如果不手动设置 ScrollView 的高度,如何阻止这种情况发生?
我已经使用了android:layout_height="wrap_content"我所有的观点。
这不是应该自动分配视图的高度以适应屏幕的高度吗?
(想包含图片,但我的代表还不够高(-_- ))