Ich versuche, meine Navigationsschublade so zu ändern, dass sie der neuen Google Mail-App ähnelt. Ich verwende AppCompatv7 - v21 und habe den aktualisierten SDK. Was fehlt mir? Bitte beachten Sie die Bilder unten.Navigationsschublade: Gmail vs AppCompatv7 v21
Gmail Navigation:
Die Schublade Navigation, bewegt sich über die Symbolleiste.
Meine aktuelle Navigation:
Die Navigationsleiste kommt unterhalb der Symbolleiste.
[EDIT]
Dies war mein früherer XML-Code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_with_spinner" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<ListView
android:id="@+id/listview_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/dark_grey"
android:choiceMode="singleChoice"
android:divider="@drawable/drawer_list_divider"
android:dividerHeight="2dp" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
nun gemäß dem Vorschlag von pedro, habe ich versucht, die Symbolleiste innerhalb drawerlayout zu bewegen.
Hier ist meine neue xml:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_with_spinner" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<ListView
android:id="@+id/listview_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
android:choiceMode="singleChoice"
android:divider="@drawable/drawer_list_divider"
android:dividerHeight="2dp" />
</android.support.v4.widget.DrawerLayout>
Das ist mein aktueller Code ist in onCreate()
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
toolbar = (Toolbar) findViewById(R.id.toolbar);
spinner = (Spinner) toolbar.findViewById(R.id.spinner);
mDrawerList = (ListView) findViewById(R.id.listview_drawer);
Nun, ich sehe nicht, auch die Symbolleiste. Hier ist das Bild.
[EDIT]
Hier ist mein neues Layout. Dies funktioniert .. Dank wieder pedro ...
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_with_spinner" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
</LinearLayout>
<ListView
android:id="@+id/listview_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
android:choiceMode="singleChoice"
android:divider="@drawable/drawer_list_divider"
android:dividerHeight="2dp" />
</android.support.v4.widget.DrawerLayout>
Ich habe versucht, die Symbolleiste in dem drawerlayout zu setzen, aber jetzt sehe ich nicht die Symbolleiste überhaupt. Kannst du meine bearbeitete Frage ansehen? –
Wickeln Sie Ihre Symbolleiste und Ihr Rahmenlayout in ein lineares Layout. Überprüfen Sie mein Beispiel XML –
Danke, jetzt funktioniert es ... Ich habe versucht, Linearelayout vor und aus irgendeinem Grund es stürzte. Es scheint, als hätte ich es damals vermasselt. Jetzt funktioniert es gut. Danke für Ihre Hilfe!!! –