Tôi muốn hỏi, làm việc với hai hoặc nhiều RelativeLayout lồng nhau. Mã đầu tiên trông giống như hình ảnh 1, Khi tôi thêm android:layout_alignParentRight="true"
trong RelativeLayout thứ hai, điều này trông giống như hình ảnh 2. Tôi muốn căn chỉnh văn bản bên phải để thứ hai RelativeLayout. Đâu là lỗi của tôi?hai hoặc nhiều lồng nhau 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>
Hình 1:
Và tôi thêm 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>
Ảnh 2:
cố gắng thêm cho 'TextView' 'android: layout_alignParentTop = "true"' –
trường hợp xấu nhất kịch bản: Thêm' ImageView' trước khi 'TextView' thay của 'android: background =" @ drawable/picture_border_offer_first_page "'. Họ sẽ che phủ –
@ đầu tiên tôi đã thử alightTop, giống như vậy. – atasoyh