读书人

如何让3个RelativeLayout按左中右的布

发布时间: 2012-08-03 00:12:14 作者: rapoo

怎么让3个RelativeLayout按左中右的布局来排呢?
如题 。。。我是要做个标题。。类似新浪那样的。。左右分别是按钮,,中间一个textview的文字放具中,,麻烦大虾教下
左边已经设置了android:layout_alignParentLeft="true"
中间android:layout_centerHorizontal="true"
右边android:layout_alignParentRight="true"
不过中间的没有效果,还是靠右放着

[解决办法]

XML code
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="horizontal"    android:layout_width="fill_parent"    android:layout_height="fill_parent">         <RelativeLayout      android:layout_width="wrap_contentl"     android:layout_height="fill_parent"     android:layout_weight="1"     android:background="@color/red_bg"     ></RelativeLayout>      <RelativeLayout      android:layout_width="wrap_contentl"     android:layout_height="fill_parent"     android:layout_weight="1"     android:background="@color/blue_text"     ></RelativeLayout>      <RelativeLayout      android:layout_width="wrap_contentl"     android:layout_height="fill_parent"     android:layout_weight="1"     android:background="@color/red_bg"     ></RelativeLayout></LinearLayout> 

读书人网 >Android

热点推荐