android: wie kann ich add-Polsterung für ein LinearLayout innerhalb ein FrameLayout

Habe ich ein FrameLayout mit vielen Kindern. Eines der Kinder ist ein LinearLayout. Ich möchte die Breite des LinearLayout zu match_parent aber über 90%; das bedeutet, möchte ich hinzufügen, dass irgendeine Art von paddingLeft/Right oder margingLeft/Right. Aber wenn ich das padding oder margin, es wird nicht angewendet im Grafischen Layout. Wie mache ich das richtig?

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/blue" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal"
        android:background="@color/red"
        android:marginLeft="20dp"
        android:marginRight="20dp"
        android:orientation="vertical" >
....
Ich habe schon immer aufgefallen, dass es einige Probleme rund um layouts und padding/margin. Versuchen Sie Ihr Framelayout zu einem Relativelayout, Rahmen-layouts, die dafür bestimmt sind, nur ein Kind zu haben.

InformationsquelleAutor user3093402 | 2014-02-06

Schreibe einen Kommentar