Tôi đang cố gắng tìm cách căn chỉnh một mục trong bố cục liên quan đến một mục trong bố cục được bao gồm.
Dưới đây là một hình ảnh đại diện: layout_below mục bên trong bố cục được bao gồm
Và đây là ví dụ mã mà tôi đang tìm (mà rõ ràng là không hoạt động):
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<include
android:id="@+id/info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
layout="@layout/info" />
//This would be the dark grey box
<RelativeLayout
android:layout_below="@id/item1">
</RelativeLayout>
</RelativeLayout>
included.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp">
<ImageView
android:id="@+id/item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:paddingLeft="100dp"/>
</RelativeLayout>
Tôi giả sử cách tốt nhất để thực hiện việc này là định vị động hộp màu xám đậm trong mã, nhưng tôi không biết bắt đầu từ đâu. Bất cứ sự giúp đỡ nào cũng thật sự tuyệt vời.
Bạn sẽ không thể làm những gì bạn muốn (và từ quan điểm của tôi bạn sẽ không muốn làm điều đó). Xem xét thêm cửa sổ bổ sung đó trong mã. – Luksprog
Vì vậy, giải pháp này làm việc cho tôi https://stackoverflow.com/a/45450305/563735 –
Vì vậy, giải pháp này đã làm việc cho tôi. https://stackoverflow.com/a/45450305/563735 –