Navigation Drawer Android problem

abdoartiste

New member
Mar 7, 2019
1
0
0
Visit site
i have a problem on one of my activities the drawer is not showing when i'm clicking on the icon but when i swipe it's shown normally i tried to toast a message when the icon is clicked but got nothing the problem is other activities are working just fine with the same code i have a problem only with this one

Code:
 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    drawer = findViewById(R.id.drawer_layout);

    toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    toggle.setToolbarNavigationClickListener(new View.OnClickListener() {
        [MENTION=93274]overr[/MENTION]ide
        public void onClick(View view) {
            drawer.openDrawer(GravityCompat.START);
        }
    });
    toggle.setHomeAsUpIndicator(R.mipmap.nav);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    toggle.setDrawerIndicatorEnabled(false);

    navigationView = findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
and this is the layout file

Code:
 <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"
    tools:openDrawer="start">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="80dp" />
and this is the app_bar_main layout
Code:
<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"
    tools:context="com.vpapps.hdwallpaper.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:elevation="0dp"
        android:theme="@style/AppTheme.AppBarOverlay"
        tools:targetApi="lollipop">

        <com.vpapps.utils.StatusBarView
            android:id="@+id/statusBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"/>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/colorPrimaryDark"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            android:elevation="0dp"
            tools:targetApi="lollipop" />

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

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

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

i tried many things but still same problem thanks