Layout frage: ListView über LinearLayout

  • Antworten:4
Tobi H
  • Forum-Beiträge: 292

21.03.2011, 19:53:06 via Website

Hallo, ich habe ein Problem, ich plane folgendes Layout: Am unteren Rand befindest sich ein Horizontales LinearLayout mit 3 Buttons, feste Höhe. Und darüber soll der restliche Platz von einem ListView gefüllt werden.

Das habe ich bisher:
1<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/main_tab_home" android:orientation="vertical">
2 <ListView android:id="@+id/listView1" android:layout_width="wrap_content" android:layout_height="wrap_content"></ListView>
3 <LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout1" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_gravity="center_horizontal">
4 <Button android:text="Button" android:id="@+id/button1" android:layout_height="40dip" android:layout_width="100dip"></Button>
5 <Button android:layout_height="40dip" android:text="Button" android:id="@+id/button2" android:layout_width="100dip"></Button>
6 <Button android:layout_height="40dip" android:text="Button" android:id="@+id/button3" android:layout_width="100dip"></Button>
7 </LinearLayout>
8</LinearLayout>

was muss ich ändern?

Antworten
Schmju
  • Forum-Beiträge: 39

21.03.2011, 22:04:22 via App

beim listview: height auf fill parent

und das untere horizontale Layout eine layout weight geben "1" zum Beispiel ...

Antworten
Ansgar M
  • Forum-Beiträge: 1.544

21.03.2011, 23:56:34 via App

Hey,
ich würde es ähnlich machen.
ListView auf wrap_content und weight auf 1 und unten bei height wrap_content und gravity oder so auf bottom.
Lg Ansgar

Antworten
Stefan S.
  • Forum-Beiträge: 560

23.03.2011, 08:08:31 via Website

Du kannst in der ListView auch einen marginBottom setzen um die Liste zu verkürzen. Dann noch das Layout_Height auf 0 stellen.

Antworten
Tobi H
  • Forum-Beiträge: 292

23.03.2011, 09:38:21 via Website

Danke. hat geklappt

Antworten