Question

Je veux créer un élément de liste personnalisée. Fondamentalement, il devrait 3 zones dans une LinearLayout horizontale. Tout au plus gauche est censé être 50dp large, le droit le plus un aussi. Je voudrais une au milieu pour prendre le reste de l'espace. A la fin, il devrait être 50px | largeur - 100px | 50px.

Puis-je faire en XML?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="100dp"
    android:gravity="right" >

    <FrameLayout
        android:id="@+id/frameLayout1"
        android:layout_width="50dp"
        android:layout_
        android:layout_height="match_parent" 
        android:layout_weight="0">
    </FrameLayout>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="wrap_content"
        android:layout_height="match_parent" 
        android:gravity="fill"
        android:orientation="vertical" 
        android:layout_weight="0">

    </LinearLayout>

    <FrameLayout
        android:id="@+id/frameLayout2"
        android:layout_width="50dp"
        android:layout_height="match_parent"
        android:layout_weight="0" >

    </FrameLayout>

</LinearLayout>
Était-ce utile?

La solution

Just set the layout-weight of the middle item to 1. And layout_width to fill_parent.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top