如何创建固定页脚的android布局? [英] How to create fixed footer in android layout?

查看:125
本文介绍了如何创建固定页脚的android布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆