我想問,使用兩個或更多嵌套的RelativeLayout。 第一個代碼看起來像圖片1,當我在第二個RelativeLayout中添加android:layout_alignParentRight="true"
時,這看起來像圖片2.我想將文本右對齊到第二個RelativeLayout。哪裏是我的錯嗎?兩個或更多嵌套RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:background="@drawable/background"
android:layout_height="wrap_content"
android:id="@+id/testRL">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/testRotateLL"
android:background="@drawable/picture_border_offer_first_page">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="7000TL"
android:textSize="15sp"
android:textColor="@android:color/white"
android:id="@+id/amountLayoutTV" />
</RelativeLayout>
</RelativeLayout>
圖片1:
我添加android:layout_alignParentRight="true"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:background="@drawable/background"
android:layout_height="wrap_content"
android:id="@+id/testRL">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/testRotateLL"
android:background="@drawable/picture_border_offer_first_page">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="7000TL"
android:layout_alignParentRight="true"
android:textSize="15sp"
android:textColor="@android:color/white"
android:id="@+id/amountLayoutTV" />
</RelativeLayout>
</RelativeLayout>
圖2:
嘗試添加到''TextView'機器人:layout_alignParentTop = 「真正的」' –
最壞的情況:前'TextView'添加'ImageView'代替'android:background =「@ drawable/picture_border_offer_first_page」'。他們將覆蓋 –
@首先我試着alightTop,它的一樣。 – atasoyh