Frage

Ich möchte ein benutzerdefiniertes Listenelement erstellen. Grundsätzlich sollten 3 Bereiche in einem horizontalen Bereich LinearLayout. Das links soll 50 dp breit sein, auch das rechte am besten. Ich möchte, dass der in der Mitte den Rest des Raums einnimmt. Am Ende sollte es 50px sein | Breite - 100px | 50px.

Kann ich das in XML machen?

<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>
War es hilfreich?

Lösung

Einfach die layout-weight des mittleren Gegenstands bis 1. und layout_width zu fill_parent.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top