2017-10-04 1 views
0

aus irgendeinem Grund kann ich nicht herausfinden, warum mein Hamburger-Symbol kann nicht gesehen werden, kann aber immer noch ausgewählt werden und alles ist so verteilt, als ob es immer noch da ist. Dies geschieht auch mit dem 3 horizontalen Punktsymbol auf der gegenüberliegenden Seite, das ich eingerichtet hatte, um zum Abmeldebereich zu gelangen.Android Symbolleiste Symbol fehlt aber kann immer noch ausgewählt werden

MainActivity.java

public class MainActivity extends AppCompatActivity implements 
NavigationView.OnNavigationItemSelectedListener { 

private Toolbar mToolbar; 
private DrawerLayout mDrawerLayout; 




@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(myToolbar); 

    // Find our drawer view 
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 

    setupToolbarMenu(); 
    setupNavigationDrawerMenu(); 

} 
private void setupToolbarMenu() { 

    mToolbar = (Toolbar) findViewById(R.id.toolbar); 
    mToolbar.setTitle("Recovery Toolkit"); 
} 
private void setupNavigationDrawerMenu() { 

    NavigationView navigationView = (NavigationView) 
    findViewById(R.id.nav_view); 
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 
    navigationView.setNavigationItemSelectedListener(this); 

    ActionBarDrawerToggle drawerToggle = new 
    ActionBarDrawerToggle(this, 
      mDrawerLayout, 
      mToolbar, 
      R.string.drawer_open, 
      R.string.drawer_close); 

    mDrawerLayout.addDrawerListener(drawerToggle); 
    drawerToggle.syncState(); 
} 

activity_main.xml

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:context=".activity.SplashActivity" 
tools:openDrawer="start"> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/MyMaterialTheme"> 

<include layout="@layout/toolbar" /> 

</android.support.design.widget.AppBarLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

</android.support.design.widget.CoordinatorLayout> 

</LinearLayout> 


<!-- Navigation View --> 
<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="@dimen/nav_drawer_width" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/nav_header_main" 
    android:fitsSystemWindows="true" 
    app:menu="@menu/activity_main_drawer" 
    android:theme="@style/MyMaterialTheme"/> 

toolbar.xml

nav_header_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="@dimen/nav_drawer_width" 
android:layout_height="190dp" 
android:elevation="16dp" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:background="@drawable/background_header"> 



<LinearLayout 
    android:layout_width="@dimen/nav_drawer_width" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    android:paddingBottom="15dp" 
    android:paddingStart="15dp" 
    android:paddingEnd="15dp" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentStart="true" 
    android:layout_marginTop="56dp"> 


    <ImageView 
     android:id="@+id/user_profile" 
     android:layout_width="@dimen/nav_drawer_profile_image_size" 
     android:layout_height="50dp" 
     android:gravity="bottom" 
     app:srcCompat="@drawable/ic_account_circle_white_64dp" 
     tools:ignore="ContentDescription" /> 

    <ImageView 
     android:layout_width="@dimen/nav_drawer_width" 
     android:layout_height="wrap_content" 
     android:contentDescription="@string/item_desc" /> 


    <TextView 
     android:id="@+id/txvName" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_weight="3" 
     android:fontFamily="roboto-bold" 
     android:gravity="bottom" 
     android:text="@string/user_name" 
     android:textColor="@color/colorPrimaryText" 
     android:textSize="14sp" /> 

    <TextView 
     android:id="@+id/txvEmail" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_weight="1" 
     android:fontFamily="roboto" 
     android:gravity="bottom" 
     android:text="@string/email" 
     android:textColor="@color/colorPrimaryText" 
     android:textSize="14sp" /> 

</LinearLayout> 

+0

Bitte hier 'R.layout.activity_main' posten. –

+0

post Ihre Layout-Toolbar Xml-Datei und Ihre Navigationsansicht XML-Datei sowie die Aktivität, die die Schublade Wurzel verwendet – Sam

Antwort

0

ich Ihre Hilfe jeder zu schätzen wissen, aber scheint, dass ich nur fehlte:

local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" 

Sobald ich, dass alles normal gestartet Arbeit aufgenommen. Danke noch einmal!

0
drawerToggle.setDrawerIndicatorEnabled(true); 

diese Zeile hinzufügen. Beispiel:

. 
. 
mDrawerLayout.addDrawerListener(drawerToggle); 
drawerToggle.setDrawerIndicatorEnabled(true); 
drawerToggle.syncState(); 

(Es tut mir leid .Ich genug Kredite nicht zu kommentieren) EDIT

: Sie versuchen, dieses Layout und sehen es

activity_main.xml

arbeitet
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true" 
tools:context=".activity.SplashActivity" 
tools:openDrawer="start"> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

<android.support.design.widget.CoordinatorLayout 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/MyMaterialTheme"> 



</android.support.design.widget.AppBarLayout> 

<include layout="@layout/toolbar" /> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

</android.support.design.widget.CoordinatorLayout> 

</LinearLayout> 


<!-- Navigation View --> 
<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="@dimen/nav_drawer_width" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/nav_header_main" 
    android:fitsSystemWindows="true" 
    app:menu="@menu/activity_main_drawer" 
    android:theme="@style/MyMaterialTheme"/> 

toolbar.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"tools:context="com.granitemountainbhc.recoverytoolkit.activity.MainActivity"> 

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/MyMaterialTheme"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/MyMaterialTheme" 
     app:layout_scrollFlags="scroll|enterAlways" /> 



</android.support.design.widget.AppBarLayout> 

<FrameLayout 
    android:id="@+id/frame" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
</FrameLayout> 

</android.support.design.widget.CoordinatorLayout> 
+0

Ich habe drawerToggle.setDrawerIndicatorEnabled (true); aber es zeigt immer noch nicht. – mlewis27

+0

Sie müssen Ihr Symbolleistenlayout nach appBarLayout platzieren –

Verwandte Themen