tôi đã bố trí các tập tin sau đây:Tại sao layout_marginBottom bị bỏ qua khi sử dụng wrap_content?
<?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="wrap_content"
android:background="#FF0000" >
<RelativeLayout
android:id="@+id/usericon_img"
android:layout_width="73.3334dp"
android:layout_height="70.6667dp"
android:layout_marginBottom="2.6667dp"
android:layout_marginLeft="3.3334dp"
android:layout_marginTop="2.6667dp"
android:background="#FFFFFF" />
</RelativeLayout>
trên giả lập (Tôi đã thử nghiệm nó trên một thiết bị thực và có vẻ giống nhau) bố trí trông như thế này:
Câu hỏi của tôi là: tại sao tôi không có lề màu đỏ dưới bố cục màu trắng? Tôi biết rằng nếu tôi thay đổi bố cục bên ngoài thành:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="76dp"
android:background="#FF0000" >
Tôi sẽ nhận được những gì tôi muốn, nhưng tại sao wrap_content không hoạt động chính xác?
Tôi đã sử dụng 70.6667 vì tôi muốn có kích thước 106 pixel trên màn hình hdpi. – Toorop
nếu lề bị bỏ qua, tại sao tôi có lề trái và trên? – Toorop
thử sử dụng đệm thay vì – Ahmad