Ich möchte ein Layout erstellen, mit einem horizontalen LinearLayout (s) oben und unten, ein ListView füllen in der Mitte.Layout-Problem: Wie platziert man etwas oben und unten?
Wie kann ich die main.xml definieren?
Ich habe versucht, ein Layout mit horizontalen LinearLayout oben, TextView auf der Unterseite, eine ListView ausfüllen in der Mitte; ist in Ordnung. Aber nachdem ich den unteren TextView auf LinearLayout geändert habe, verschwindet der untere LinearLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:textSize="12px"
android:text="something here"
android:layout_width="50px"
android:layout_height="wrap_content"
/>
<TextView
android:textSize="12px"
android:text="something here"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
>
<ListView
android:id="@+id/listbody"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:textSize="12px"
android:text="50%"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:textSize="12px"
android:text="50%"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Kann jemand beraten? Bitte helfen.
Nun überlappt das LinearLayout mit dem ListView! Ich denke, bei der Definition des LinearLayouts unten sollte etwas falsch sein. – chow
Nicht besonders. Für die Listview hinzu: \t android: layout_height = "wrap_content" \t android: layout_width = "fill_parent" \t android: layout_below = "@ id/top_linear_layout_id" \t android: layout_above = "@ + id/bottom_linear_layout_id" Zusammen mit den jeweiligen IDs für die linearen Layouts. – Estel