Android的线性布局 - 如何让元在底部的观点? [英] Android Linear Layout - How to Keep Element At Bottom Of View?

查看:322
本文介绍了Android的线性布局 - 如何让元在底部的观点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我想针在正在使用的LinearLayout与垂直排列的元素的景观活动的底部一个TextView。我已经设置的android:重力=底的文本视图,但它仍然喜欢是仅仅的LinearLayout的到底是什么,我不希望它做的最后一个元素下方。有什么建议么?谢谢

I have a TextView which I want to pin at the bottom of a landscape activity that is using LinearLayout with vertically arranged elements. I have set android:gravity="bottom" on the text view but it still likes to be just below the last element of the LinearLayout exactly what I don't want it to do. Any suggestions? Thanks

推荐答案

取的TextView出的LinearLayout中,然后把的LinearLayout和内部RelativeLayout的TextView的。添加属性安卓layout_alignParentBottom =真正的的TextView的。与所有的命名空间,除了省略上述属性其他属性:

Take the TextView out of the LinearLayout, then put the LinearLayout and the TextView inside a RelativeLayout. Add the attribute android:layout_alignParentBottom="true" to the TextView. With all the namespace and other attributes except for the above attribute elided:

<RelativeLayout>
  <LinearLayout>
    <!-- All your other elements in here -->
  </LinearLayout>
  <TextView
    android:layout_alignParentBottom="true" />
</RelativeLayout>

这篇关于Android的线性布局 - 如何让元在底部的观点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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