9
私は、次のレイアウトファイルがあります:エミュレータ上wrap_contentを使用しているときにlayout_marginBottomが無視されるのはなぜですか?
<?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>
(私は実際のデバイス上でそれをテストしてみたし、それが同じに見える)レイアウトは次のようになります。
私の質問は次のとおりです。なぜ私は白いレイアウトの下に赤いマージンがないのですか?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="76dp"
android:background="#FF0000" >
私は欲しいものを手に入れますが、なぜwrap_contentが正しく動作しないのでしょうか? documentationで
私は706667を使用しました。なぜなら、hdpiスクリーン上に106ピクセルの寸法が必要だからです。 – Toorop
余白を無視すると、余白が残っているのはなぜですか? – Toorop
代わりにパディングを使用してみてください – Ahmad