【发布时间】:2011-02-10 22:54:20
【问题描述】:
我有一个 RelativeLayout,它有一个 LinearLayout 作为包含 TextViews 的子级。
我想用 layout_alignRight="@id/userdetail_tv_special" 将 ImageViews 放置在 TextViews 的右侧,但不知何故这不起作用。
我不能将 RelativeLayout 的子代“链接”到 LinearLayout 的子代吗?有什么想法可以在不为每个按钮创建另一个 RelativeLayout 的情况下实现这一点吗?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/userdetail_lin_btncontainer"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_below="@id/userdetail_lin_divider"
android:padding="6dp" >
<TextView
android:id="@+id/userdetail_tv_special"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Special"
android:background="#cccccc" />
<!-- here are more TextViews like this one -->
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/userdetail_tv_special"
android:src="@drawable/ic_detail_special" />
<!-- much more views and stuff -->
</RelativeLayout>
【问题讨论】:
标签: android android-linearlayout android-relativelayout