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

如何让3个RelativeLayout按左中右的布局来排呢

2012-08-03 
怎么让3个RelativeLayout按左中右的布局来排呢?如题 。。。我是要做个标题。。类似新浪那样的。。左右分别是按钮,

怎么让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> 

热点排行