如何设置页眉,可滚动内容和页脚?在Android中 [英] How to set Header , Scrollable content and Footer? in Android
本文介绍了如何设置页眉,可滚动内容和页脚?在Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使中间部分可滚动.我什么都不知道.这是我的xml大纲.我想将此xml大纲插入可滚动区域.
I want to make middle part to be scrollable. I couldn't get any idea.. and this is my xml outline. I want to insert this xml outline in scrollable area.
注意:页眉和页脚必须恒定.只需滚动中间区域
Note: Header and Footer has to be constant. Only middle area has to be scrolled
推荐答案
更简单的方法是使用:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/headerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
</LinearLayout>
<ScrollView
android:id="@+id/scrollablContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/footerView"
android:layout_below="@+id/headerView" >
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/footerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
</LinearLayout>
</RelativeLayout>
这篇关于如何设置页眉,可滚动内容和页脚?在Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文