读书人

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

发布时间: 2012-03-18 13:55:39 作者: rapoo

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"

读书人网 >Android

热点推荐