<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/newslist_item_layout"
android:layout_width="fill_parent"
android:layout_height="82.0dip"
android:background="@drawable/newslist_item_selector"
android:descendantFocusability="blocksDescendants"
android:marqueeRepeatLimit="marquee_forever">
<RelativeLayout
android:id="@id/newslist_item_info_layout"
android:layout_width="fill_parent"
android:layout_height="82.0dip"
android:layout_marginRight="20.0dip">
<TextView
android:id="@id/newslist_item_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="14.0dip"
android:layout_marginTop="4.0dip"
android:layout_marginRight="10.0dip"
android:layout_alignParentLeft="true"
android:textSize="18.0dip"
android:textStyle="bold"
android:textColor="@color/newslist_item_title_selector"
android:text="我是title "
android:singleLine="true"
android:marqueeRepeatLimit="marquee_forever" />
</RelativeLayout>
<Button
android:id="@id/newslist_item_go_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/newslist_item_go_detail_selector"
android:layout_marginRight="2.0dip"
android:layout_toLeftOf="@id/newslist_item_info_layout"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
一个简单的相对布局,在下面button有一句:android:layout_toLeftOf="@id/newslist_item_info_layout"
按理说应该这个button在 控件newslist_item_info_layout 的左侧,可实际为什么在右侧呢?
我改为android:layout_toRightOf="@id/newslist_item_info_layout"后,就不现实右侧那个button按钮了
android:layout_alignParentRight="true",可能是这句话的原因,你试试吧