Ich verwende das folgende Layout. Im Grunde hat es eine benutzerdefinierte Symbolleiste, eine Navigationsleiste, ein Menü, eine ListView (listView1) und adlay.ListView fällt nach unten
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/header_bg"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_above="@+id/adlay"
android:layout_margin="7dp"
android:cacheColorHint="#00000000"
android:divider="@android:color/transparent"
android:dividerHeight="3dp">
</ListView>
<LinearLayout
android:id="@+id/adlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
</LinearLayout>
</RelativeLayout>
<ListView
android:id="@+id/drawer_list"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#eee"
android:dividerHeight="1dp"
android:background="#fff"
android:layout_below="@+id/toolbar"
>
</ListView>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Das Layout ist ein bisschen wie die folgende Reihenfolge:
- Toolbar (mit Navigationsleiste und Menü)
- ListView1
- adlay
ListView1 besteht aus einer Liste von Elementen, die aus externen XML-Dateien geladen werden.
Problem ist das. Wenn listView1's Elemente nicht viel sind, dann fällt es nach unten, sitzt über adlay und es gibt eine Lücke über listView1 zwischen der Symbolleiste und listView1. Das Display ist wie folgt aus:
- Toolbar (mit Navigationsleiste und Menü)
- GAP! < --- Ich will nicht, dass die Lücke hier ist!
- ListView1
- Adlay
Dies ist nicht erwünscht Anzeige.
Idealerweise möchte ich folgendes:
- Toolbar (mit Navigationsleiste und Menü)
- ListView1
- GAP sollte hier sein
- adlay
Jede Hilfe viel ist geschätzt. Vielen Dank.
Können Sie einen Screenshot des Problems hinzufügen? – motis10
Danke für die Antwort. Aber ich habe das Problem behoben, alles in meinem Layout wie oben beibehalten, aber nur die layout_height von listView1 zu match_parent geändert. – Dopinder