如何创建固定页脚的android布局? [英] How to create fixed footer in android layout?
问题描述
我使用下面的code在活动的底部显示按钮。
I am using following code to display button at the bottom of activity.
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
>
<Button android:id="@+id/btnGetMoreResults"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Get more"
/>
</RelativeLayout>
和列表视图上面。当我显示列表视图此按钮潘内尔移动down.can任何一个或多个数据指引,我该如何解决在活动的底部?
and listview above it. when i display more data in listview this button pannel is moved down.can any one guide me how can i fix it at the bottom of activity?
任何帮助将是AP preciated。
any help would be appreciated.
推荐答案
在安卓layout_alignParentBottom
属性已在一个元素被宣布为 RelativeLayout的
不在 RelativeLayout的
自己(除非有另一个 RelativeLayout的
作为父母)。
The android:layout_alignParentBottom
attribute has to be declared in an element of the RelativeLayout
not in the RelativeLayout
himself (unless there is another RelativeLayout
as a parent).
您应该做这样的事情,与的ListView
在 RelativeLayout的
也:
You should do something like this, with the ListView
inside the RelativeLayout
also :
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
<ListView ...>
<Button android:id="@+id/btnGetMoreResults"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Get more"
android:layout_alignParentBottom="true" />
</RelativeLayout>
这篇关于如何创建固定页脚的android布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!