我有這個問題,我需要把TextView的(綠色)內下方的RelativeLayout(黑色),但ImageView的(橙色)的RelativeLayout(藍色)保持重疊如何將TextView放置在另一個RelativeLayout的RelativeLayout中?
這裏的傳說:
- RelativeLayout的(黑色)ID/image_view_container
- ImageView的(褐色)
- RelativeLayout的(藍色)
- ImageView的(橙色)ID/profileImage
- 的TextView(綠色)
我想:
android:layout_toRightOf="@id/profileImage"
android:layout_below="@id/image_view_container"
,但它不工作,可能是因爲image_view_container
是從另一個RelativeLayout的。
我需要幫助,謝謝!
編輯:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/image_view_container" >
<ImageView
android:id="@+id/mainImage"
android:layout_width="fill_parent"
android:layout_height="210dp"
android:background="#ffffff"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-30dp"
android:gravity="bottom"
android:orientation="horizontal" >
<ImageView
android:id="@+id/profileImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_weight="0"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:scaleType="centerCrop"
/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_below="@id/image_view_container"
android:layout_toRightOf="@id/profileImage"
android:layout_weight="1"
android:text="6363"
android:textColor="@color/A"
android:textSize="20sp"
android:textStyle="bold"
android:translationY="5dp" />
</RelativeLayout>
後完整的XML請,好像你的藍相對佈局容器不是道具呃 –
你怎麼包括_the other_ layout? – ozbek
請發佈您的整個XML文件... – Shrikant