Tôi có XML sau:RelativeLayout - CenterInParent và marginTop
<RelativeLayout android:id="@+id/cover_box"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView android:id="@+id/cover"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageView android:id="@+id/download" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/mark_download"
android:layout_centerInParent="true" android:layout_marginTop="90px" />
</RelativeLayout>
Nhưng nó trông giống như các marginTop đang được bỏ qua.
Nếu đó là trường hợp, sau đó thay đổi bên lề để một giá trị cao sẽ thay đổi vị trí của hình ảnh. Nhưng tôi đang thử nghiệm trên Android 4.2 và có vẻ như centerInParent hoàn toàn ghi đè bất kỳ lề nào trong bố cục Tương đối. – Behnam