<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/right_area"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="@drawable/tab_clicked_shadow_right" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="0dp"
android:src="@drawable/hall_home" />
</RelativeLayout>
</RelativeLayout>导致right_area这个RelativeLayout的width的效果是充满整个屏幕,也就是说不在根上的RelativeLayout中如果有一个靠右的控件,会导致这个RelativeLayout的宽度效果变为fill-parent
本文解析了一个特定的XML布局文件,展示了如何使用RelativeLayout实现控件靠右排列,并解释了这种布局方式如何影响父级RelativeLayout的宽度设置。
318

被折叠的 条评论
为什么被折叠?



