Problem mit Toolbar und Navigation Drawer

  • 1 Antworten
  • Letztes Antwortdatum
T

TortenTheo

Gast
Hallo,

ich haben wie oben beschrieben ein Problem mit der Toolbar in Verbindung mit dem Navigation Drawer.

Im Internet hab ich reichlich Anleitungen gefunden aber leider keine Lösung für meine Probleme.

1. Problem Toolbar
Beim öffnen des Navigation Drawer wird die Toolbar mit einem Schatten belegt.

2. Problem die Toolbar wird einigen Geräten im Landscape ein bisschen von Navigation Drawer überdeck.

Nexus 7 und Acer A701 keine Problem

HTC M8 und Sony Xperia Z Ultra überdeckt der Navigation Drawer die Toolbar im Landscape Format.
Bei der Toolbar wird der Inhalt(Titel) verkleinert. Die Toolbar selbst behält ihre Größe/Höhe.

Layout der Activity:
Code:
 <android.support.v4.widget.DrawerLayout
    android:id="@+id/start_activity_drawer_layout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".start_activity_code">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <include
            layout="@layout/default_toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

        <FrameLayout
            android:id="@+id/start_activity_container_portrait"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </FrameLayout>

    </FrameLayout>

    <fragment
        android:id="@+id/start_activity_hauptmenu"
        android:name="de.abc.xyz.views.hauptmenu_fragment_code"
        android:layout_width="200dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:layout_marginTop="?attr/actionBarSize"
        tools:layout="@layout/hauptmenu_fragment_layout"/>
</android.support.v4.widget.DrawerLayout>

Layout ToolBar.
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="UnusedAttribute"
    android:id="@+id/default_toolbar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/colorPrimary"
    />


Danke für Eure Hilfe.
 
Für alle die das gleiche Problem haben hier eine Lösungsmöglichkeit.

Layout der Activity
Code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:orientation="vertical"
              tools:context=".MainActivity">

    <!-- Toolbar -->
    <include
        layout="@layout/default_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <android.support.v4.widget.DrawerLayout
        android:id="@+id/start_activity_drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".start_activity_code">

            <FrameLayout
                android:id="@+id/start_activity_container_portrait"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
            </FrameLayout>


        <fragment
            android:id="@+id/start_activity_hauptmenu"
            android:name="de.xyz.xyz.hauptmenu_fragment_code"
            android:layout_width="200dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            tools:layout="@layout/hauptmenu_fragment_layout"/>

    </android.support.v4.widget.DrawerLayout>
</LinearLayout>
 
Zurück
Oben Unten