[img]http://dl.iteye.com/upload/attachment/545119/2036e03f-7b67-3121-af40-cea2a968b22c.png[/img]
该图片中为android布局:
总布局为 RelativeLayout
AtLeft 为居左
<TextView android:background="#ff0000ff" android:id="@+id/tvwAtLeft"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="AtLeft" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"></TextView>
AtRight为居右
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_alignParentTop="true"
android:layout_alignParentRight="true" android:id="@+id/tvwAtRight"
android:text="AtRight" android:background="#ff0000ff"></TextView>
Scroll为中间的布局
<TextView android:layout_height="wrap_content"
android:layout_alignParentTop="true" [b]android:layout_toRightOf="@+id/tvwAtLeft"[/b]
[b]android:layout_width="fill_parent"[/b] android:id="@+id/tvwScrolling"
[b]android:layout_toLeftOf="@+id/tvwAtRight[/b]" android:text="Scrolling"
android:background="#FFFF0000"></TextView>
在中间的布局设置了[b]android:layout_width="fill_parent"[/b]
[b]android:layout_toRightOf="@+id/tvwAtLeft"[/b]
[b]android:layout_toRightOf="@+id/tvwAtLeft"[/b]
三个属性后,那么将会有类似于LinearLayout布局中的layout_weight="1"(大于0的值)一样的效果,宽度进行了自适应
该图片中为android布局:
总布局为 RelativeLayout
AtLeft 为居左
<TextView android:background="#ff0000ff" android:id="@+id/tvwAtLeft"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:text="AtLeft" android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"></TextView>
AtRight为居右
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_alignParentTop="true"
android:layout_alignParentRight="true" android:id="@+id/tvwAtRight"
android:text="AtRight" android:background="#ff0000ff"></TextView>
Scroll为中间的布局
<TextView android:layout_height="wrap_content"
android:layout_alignParentTop="true" [b]android:layout_toRightOf="@+id/tvwAtLeft"[/b]
[b]android:layout_width="fill_parent"[/b] android:id="@+id/tvwScrolling"
[b]android:layout_toLeftOf="@+id/tvwAtRight[/b]" android:text="Scrolling"
android:background="#FFFF0000"></TextView>
在中间的布局设置了[b]android:layout_width="fill_parent"[/b]
[b]android:layout_toRightOf="@+id/tvwAtLeft"[/b]
[b]android:layout_toRightOf="@+id/tvwAtLeft"[/b]
三个属性后,那么将会有类似于LinearLayout布局中的layout_weight="1"(大于0的值)一样的效果,宽度进行了自适应