如题 我是要做个标题。。类似新浪那样的。。左右分别是按钮,,中间一个textview的文字放具中,,麻烦大虾教下
左边已经设置了android:layout_alignParentLeft="true"
中间android:layout_centerHorizontal="true"
右边android:layout_alignParentRight="true"
不过中间的没有效果,还是靠右放着
左边已经设置了android:layout_alignParentLeft="true"
中间android:layout_centerHorizontal="true"
右边android:layout_alignParentRight="true"
不过中间的没有效果,还是靠右放着
左右两个RelativeLayout的layout_width设置wrap_content或者定值,中间一个layout_width设置fill_parent并且layout_weight设置成1ps:实际完全不需要用三个RelativeLayout,直接用linearlayout水平布局就行了吧
<?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>