首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android如何设置能把控件放在屏幕最下面

2012-03-18 
android怎么设置能把控件放在屏幕最下面没分了,请大家见谅[解决办法]在你的xml文件里,给你的控件加个属性

android怎么设置能把控件放在屏幕最下面
没分了,请大家见谅

[解决办法]
在你的xml文件里,给你的控件加个属性 android:layout_gravity="bottom"
[解决办法]
经测试:

XML code
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" >    <TextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello"         android:background="@android:drawable/edit_text"        android:layout_alignParentBottom="true"/></RelativeLayout>
[解决办法]
XML code
<?xml version="1.0" encoding="utf-8"?><!--首先要用RelativeLayout相对布局,因为线性布局不支持有些属性--><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" ><!--第二将你要摆在屏幕最底下的控件设置属性android:layout_alignParentBottom="true",意思是将此控件位于父控件的底部,这个属性页可以加载布局layout中-->    <TextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:text="@string/hello"         android:background="@android:drawable/edit_text"        android:layout_alignParentBottom="true"/></RelativeLayout>
[解决办法]
探讨
在你的xml文件里,给你的控件加个属性 android:layout_gravity="bottom"

热点排行