XML里怎么把控件置于屏幕最下。

w7244958 2011-04-18 02:44:56
XML里怎么把控件置于屏幕最下。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ViewTitle="http://schemas.android.com/apk/res/com.android.task"
xmlns:XXXX="http://schemas.android.com/apk/res/com.android.task"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="aaaaa"
android:textColor="#FFFFFF"
android:textSize="10dip"
android:gravity="bottom"
></TextView>
</LinearLayout>

请问这样可以吗,啊?是否通过gravity设置,还是通过其他的设置。请指点一下。谢!
...全文
130 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
yxmsw2007 2011-04-18
  • 打赏
  • 举报
回复
把LinearLayout中orientation的属性改成android:orientation="horizontal"就可以了,也可以用4L的方法实现
[Quote=引用 4 楼 drsmart 的回复:]
用相对布局,使用android:layout_alignParentBottom这个属性,
[/Quote]
DrSmart 2011-04-18
  • 打赏
  • 举报
回复
用相对布局,使用android:layout_alignParentBottom这个属性,
  • 打赏
  • 举报
回复
把android:gravity="bottom"
放到LinearLayout里面就行了!
zhuxr2003 2011-04-18
  • 打赏
  • 举报
回复
推荐用viewgroup,可以精确定位各控件位置。xml建议全部放弃,我做的2个游戏都没有用xml配置,xml缺点是死板不灵活,自己定义控件才好。
Eric1006 2011-04-18
  • 打赏
  • 举报
回复
可以考虑使用其它布局,比如TableLayout。

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧