Gen*_* S. 2 android android-layout
我有一个活动,屏幕顶部有一个标题,屏幕底部有一些按钮元素,然后我想将中间(剩下的任何东西)投入到滚动视图中.
我知道如何做除了如何为ScrollView指定高度以外的所有内容,该高度将考虑其上方和下方的内容,然后在其间居住.
很想看到如何实现这种效果的XML示例.
TIA
您可以使用相对布局.
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/header">
<!--Header elements here-->
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:alignParentBottom="true"
android:id="@+id/footer">
<!--Footer element here-->
</LinearLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/footer"
android:layout_below="@+id/header">
</ScrollView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3799 次 |
| 最近记录: |