请教用代码表达一段xml布局文件 有些属性是根据不同lay_out 生效的。并不是说你能加进去而且没报错就能用。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 android:layout_gravity是LinearLayout的一个属性,RelativeLayout中不支持这个属性 <?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" ><FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayoutandroid:id="@+id/layout01"android:layout_width="fill_parent" android:layout_height="fill_parent" ><TextView android:id="@+id/text0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:textColor="#ffff0000" android:text="top" /> <TextView android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:textColor="#ff00ff00" android:text="center" /> <TextView android:id="@+id/start" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ff0000ff" android:layout_gravity="bottom" android:text="bottom" /> </LinearLayout></FrameLayout> </RelativeLayout>这样试试,将3个TextView看做是一个整体 三楼dinjay,我的那个布局文件显示也没问题哦,支持android:layout_gravity,不过当我想通过代码来实现这一段布局文件时,却不行, 看了四楼dinjay的布局文件,奇怪,这个布局中的android:layout_gravity="center" 不再屏幕中心显示? 怎样对APP流量进行统计 关于android获取录音音量的问题。 android如何实现大文件下载(只能通过80端口,服务器端用asp.net) 编写一个简易的图片浏览器 多个(三个以上)activity跳转intent处理问题 求关于SIM卡的资料,android的最好 关于TextView显示换行的问题 如何往外置sd卡中写入数据 android4.4.2默认勾选多国语言为输入法怎么弄 ? mediaplayer问题相关 播放过程自动触发onerror方法 望大神解答 有一个tablerow 对象 如何copy 或者colne这个对象? 初学android ,请教2
<?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" ><FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/layout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/text0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:textColor="#ffff0000"
android:text="top"
/>
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#ff00ff00"
android:text="center"
/>
<TextView
android:id="@+id/start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ff0000ff"
android:layout_gravity="bottom"
android:text="bottom"
/>
</LinearLayout>
</FrameLayout> </RelativeLayout>
这样试试,将3个TextView看做是一个整体
?