My NavigationView won't show in DrawerLayout in Android Studio











up vote
-1
down vote

favorite












This is the first time I creating navigation in android studio, I already created the navigation header and drawer menu(they both showing in their own xml), but none of them appearing in my activity_home.xml(only Android..DrawerLayout text appears) , it even says that my header is empty, did I miss something??



This is the activity_home.xml









   <android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:id="@+id/toolbar"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat.Light"
android:elevation="4dp"/>

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




<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/nav_view"
app:headerLayout="@layout/nav_heqader" *(This line said that xml tag has empty body)*
app:menu="@menu/drawer_menu"></android.support.design.widget.NavigationView>





This is the nav_heqader.xml(slightly typo here)







>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:text="Test"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Testing"/>





This is the drawer_menu.xml






<group android:checkableBehavior="single">
<item
android:id="@+id/nav_message"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Message" />
<item
android:id="@+id/nav_chat"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Chat" />
<item
android:id="@+id/nav_profile"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profile" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilez" />
<item
android:id="@+id/nav_share2"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilezd" />
</menu>
</item>





This is the Home.java



package com.example.aldyro.movie;


import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.support.v7.widget.Toolbar;

public class Home extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mDrawerLayout = findViewById(R.id.drawer_layout);

NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(
new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
menuItem.setChecked(true);
mDrawerLayout.closeDrawers();
return true;
}
});
}


}


This is the styles.xml



<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

</resources>


This is the module:app (just in case my version isn't compatible)



apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.aldyro.movie"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}


So sorry I can't directly show the pic since I'm new here



nav_heqader screenshot



drawer_menu screenshot



activity_home screenshot










share|improve this question






















  • Are you talking about the layout editor in Android Studio? Or do you mean that your drawer doesn't work when you run the app?
    – Mike M.
    Nov 20 at 0:55










  • I think its only preview issue. It should work in device when you run. And in preview also it may be giving some rendering issue, re building project can solve this issue
    – ahuja007
    Nov 20 at 10:44















up vote
-1
down vote

favorite












This is the first time I creating navigation in android studio, I already created the navigation header and drawer menu(they both showing in their own xml), but none of them appearing in my activity_home.xml(only Android..DrawerLayout text appears) , it even says that my header is empty, did I miss something??



This is the activity_home.xml









   <android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:id="@+id/toolbar"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat.Light"
android:elevation="4dp"/>

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




<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/nav_view"
app:headerLayout="@layout/nav_heqader" *(This line said that xml tag has empty body)*
app:menu="@menu/drawer_menu"></android.support.design.widget.NavigationView>





This is the nav_heqader.xml(slightly typo here)







>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:text="Test"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Testing"/>





This is the drawer_menu.xml






<group android:checkableBehavior="single">
<item
android:id="@+id/nav_message"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Message" />
<item
android:id="@+id/nav_chat"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Chat" />
<item
android:id="@+id/nav_profile"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profile" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilez" />
<item
android:id="@+id/nav_share2"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilezd" />
</menu>
</item>





This is the Home.java



package com.example.aldyro.movie;


import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.support.v7.widget.Toolbar;

public class Home extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mDrawerLayout = findViewById(R.id.drawer_layout);

NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(
new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
menuItem.setChecked(true);
mDrawerLayout.closeDrawers();
return true;
}
});
}


}


This is the styles.xml



<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

</resources>


This is the module:app (just in case my version isn't compatible)



apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.aldyro.movie"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}


So sorry I can't directly show the pic since I'm new here



nav_heqader screenshot



drawer_menu screenshot



activity_home screenshot










share|improve this question






















  • Are you talking about the layout editor in Android Studio? Or do you mean that your drawer doesn't work when you run the app?
    – Mike M.
    Nov 20 at 0:55










  • I think its only preview issue. It should work in device when you run. And in preview also it may be giving some rendering issue, re building project can solve this issue
    – ahuja007
    Nov 20 at 10:44













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











This is the first time I creating navigation in android studio, I already created the navigation header and drawer menu(they both showing in their own xml), but none of them appearing in my activity_home.xml(only Android..DrawerLayout text appears) , it even says that my header is empty, did I miss something??



This is the activity_home.xml









   <android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:id="@+id/toolbar"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat.Light"
android:elevation="4dp"/>

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




<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/nav_view"
app:headerLayout="@layout/nav_heqader" *(This line said that xml tag has empty body)*
app:menu="@menu/drawer_menu"></android.support.design.widget.NavigationView>





This is the nav_heqader.xml(slightly typo here)







>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:text="Test"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Testing"/>





This is the drawer_menu.xml






<group android:checkableBehavior="single">
<item
android:id="@+id/nav_message"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Message" />
<item
android:id="@+id/nav_chat"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Chat" />
<item
android:id="@+id/nav_profile"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profile" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilez" />
<item
android:id="@+id/nav_share2"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilezd" />
</menu>
</item>





This is the Home.java



package com.example.aldyro.movie;


import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.support.v7.widget.Toolbar;

public class Home extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mDrawerLayout = findViewById(R.id.drawer_layout);

NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(
new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
menuItem.setChecked(true);
mDrawerLayout.closeDrawers();
return true;
}
});
}


}


This is the styles.xml



<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

</resources>


This is the module:app (just in case my version isn't compatible)



apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.aldyro.movie"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}


So sorry I can't directly show the pic since I'm new here



nav_heqader screenshot



drawer_menu screenshot



activity_home screenshot










share|improve this question













This is the first time I creating navigation in android studio, I already created the navigation header and drawer menu(they both showing in their own xml), but none of them appearing in my activity_home.xml(only Android..DrawerLayout text appears) , it even says that my header is empty, did I miss something??



This is the activity_home.xml









   <android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:id="@+id/toolbar"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/Theme.AppCompat.Light"
android:elevation="4dp"/>

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




<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/nav_view"
app:headerLayout="@layout/nav_heqader" *(This line said that xml tag has empty body)*
app:menu="@menu/drawer_menu"></android.support.design.widget.NavigationView>





This is the nav_heqader.xml(slightly typo here)







>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="8dp"
android:text="Test"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Testing"/>





This is the drawer_menu.xml






<group android:checkableBehavior="single">
<item
android:id="@+id/nav_message"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Message" />
<item
android:id="@+id/nav_chat"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Chat" />
<item
android:id="@+id/nav_profile"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profile" />
</group>

<item android:title="Communicate">
<menu>
<item
android:id="@+id/nav_share"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilez" />
<item
android:id="@+id/nav_share2"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Profilezd" />
</menu>
</item>





This is the Home.java



package com.example.aldyro.movie;


import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.support.v7.widget.Toolbar;

public class Home extends AppCompatActivity {
private DrawerLayout mDrawerLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mDrawerLayout = findViewById(R.id.drawer_layout);

NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(
new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
menuItem.setChecked(true);
mDrawerLayout.closeDrawers();
return true;
}
});
}


}


This is the styles.xml



<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>

</resources>


This is the module:app (just in case my version isn't compatible)



apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.aldyro.movie"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

}


So sorry I can't directly show the pic since I'm new here



nav_heqader screenshot



drawer_menu screenshot



activity_home screenshot







java android xml android-studio android-layout






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 14:04









Aldyro Wijaya

11




11












  • Are you talking about the layout editor in Android Studio? Or do you mean that your drawer doesn't work when you run the app?
    – Mike M.
    Nov 20 at 0:55










  • I think its only preview issue. It should work in device when you run. And in preview also it may be giving some rendering issue, re building project can solve this issue
    – ahuja007
    Nov 20 at 10:44


















  • Are you talking about the layout editor in Android Studio? Or do you mean that your drawer doesn't work when you run the app?
    – Mike M.
    Nov 20 at 0:55










  • I think its only preview issue. It should work in device when you run. And in preview also it may be giving some rendering issue, re building project can solve this issue
    – ahuja007
    Nov 20 at 10:44
















Are you talking about the layout editor in Android Studio? Or do you mean that your drawer doesn't work when you run the app?
– Mike M.
Nov 20 at 0:55




Are you talking about the layout editor in Android Studio? Or do you mean that your drawer doesn't work when you run the app?
– Mike M.
Nov 20 at 0:55












I think its only preview issue. It should work in device when you run. And in preview also it may be giving some rendering issue, re building project can solve this issue
– ahuja007
Nov 20 at 10:44




I think its only preview issue. It should work in device when you run. And in preview also it may be giving some rendering issue, re building project can solve this issue
– ahuja007
Nov 20 at 10:44












3 Answers
3






active

oldest

votes

















up vote
0
down vote



accepted










There are a lot of documentation out there for this question.



This link provide documentation of using a Navigation Drawer in Fragment, not Activity as u asking, but its very helpfull, if u are new to Android is a very good point to start.



https://guides.codepath.com/android/Fragment-Navigation-Drawer






share|improve this answer





















  • Thanks! i'll take a look later
    – Aldyro Wijaya
    Nov 19 at 14:33


















up vote
1
down vote













You can create new activity from templates available and remove your old activity.



To insert new activity with drawer select File -> New -> acitivity -> Navigation drawer activity. 


You will need to change your menu entries as required.






share|improve this answer




























    up vote
    0
    down vote













    The Drawer and the navigation menu shows when you swipe from left of the screen.



    Swipe from left to show the drawer (link to image)



    You need to setDisplayShowHomeEnabled
    and on the click you need to manage the drawer
    open and close drawer.



    Video link to your code






    share|improve this answer























    • sadly didn't working, thanks anyway
      – Aldyro Wijaya
      Nov 19 at 14:33












    • I have added the video link. It is the same code to you have written above
      – Neerav
      Nov 20 at 6:42











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376342%2fmy-navigationview-wont-show-in-drawerlayout-in-android-studio%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    There are a lot of documentation out there for this question.



    This link provide documentation of using a Navigation Drawer in Fragment, not Activity as u asking, but its very helpfull, if u are new to Android is a very good point to start.



    https://guides.codepath.com/android/Fragment-Navigation-Drawer






    share|improve this answer





















    • Thanks! i'll take a look later
      – Aldyro Wijaya
      Nov 19 at 14:33















    up vote
    0
    down vote



    accepted










    There are a lot of documentation out there for this question.



    This link provide documentation of using a Navigation Drawer in Fragment, not Activity as u asking, but its very helpfull, if u are new to Android is a very good point to start.



    https://guides.codepath.com/android/Fragment-Navigation-Drawer






    share|improve this answer





















    • Thanks! i'll take a look later
      – Aldyro Wijaya
      Nov 19 at 14:33













    up vote
    0
    down vote



    accepted







    up vote
    0
    down vote



    accepted






    There are a lot of documentation out there for this question.



    This link provide documentation of using a Navigation Drawer in Fragment, not Activity as u asking, but its very helpfull, if u are new to Android is a very good point to start.



    https://guides.codepath.com/android/Fragment-Navigation-Drawer






    share|improve this answer












    There are a lot of documentation out there for this question.



    This link provide documentation of using a Navigation Drawer in Fragment, not Activity as u asking, but its very helpfull, if u are new to Android is a very good point to start.



    https://guides.codepath.com/android/Fragment-Navigation-Drawer







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 19 at 14:14









    Catluc

    850715




    850715












    • Thanks! i'll take a look later
      – Aldyro Wijaya
      Nov 19 at 14:33


















    • Thanks! i'll take a look later
      – Aldyro Wijaya
      Nov 19 at 14:33
















    Thanks! i'll take a look later
    – Aldyro Wijaya
    Nov 19 at 14:33




    Thanks! i'll take a look later
    – Aldyro Wijaya
    Nov 19 at 14:33












    up vote
    1
    down vote













    You can create new activity from templates available and remove your old activity.



    To insert new activity with drawer select File -> New -> acitivity -> Navigation drawer activity. 


    You will need to change your menu entries as required.






    share|improve this answer

























      up vote
      1
      down vote













      You can create new activity from templates available and remove your old activity.



      To insert new activity with drawer select File -> New -> acitivity -> Navigation drawer activity. 


      You will need to change your menu entries as required.






      share|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        You can create new activity from templates available and remove your old activity.



        To insert new activity with drawer select File -> New -> acitivity -> Navigation drawer activity. 


        You will need to change your menu entries as required.






        share|improve this answer












        You can create new activity from templates available and remove your old activity.



        To insert new activity with drawer select File -> New -> acitivity -> Navigation drawer activity. 


        You will need to change your menu entries as required.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 6:48









        Karan Mer

        3,89232762




        3,89232762






















            up vote
            0
            down vote













            The Drawer and the navigation menu shows when you swipe from left of the screen.



            Swipe from left to show the drawer (link to image)



            You need to setDisplayShowHomeEnabled
            and on the click you need to manage the drawer
            open and close drawer.



            Video link to your code






            share|improve this answer























            • sadly didn't working, thanks anyway
              – Aldyro Wijaya
              Nov 19 at 14:33












            • I have added the video link. It is the same code to you have written above
              – Neerav
              Nov 20 at 6:42















            up vote
            0
            down vote













            The Drawer and the navigation menu shows when you swipe from left of the screen.



            Swipe from left to show the drawer (link to image)



            You need to setDisplayShowHomeEnabled
            and on the click you need to manage the drawer
            open and close drawer.



            Video link to your code






            share|improve this answer























            • sadly didn't working, thanks anyway
              – Aldyro Wijaya
              Nov 19 at 14:33












            • I have added the video link. It is the same code to you have written above
              – Neerav
              Nov 20 at 6:42













            up vote
            0
            down vote










            up vote
            0
            down vote









            The Drawer and the navigation menu shows when you swipe from left of the screen.



            Swipe from left to show the drawer (link to image)



            You need to setDisplayShowHomeEnabled
            and on the click you need to manage the drawer
            open and close drawer.



            Video link to your code






            share|improve this answer














            The Drawer and the navigation menu shows when you swipe from left of the screen.



            Swipe from left to show the drawer (link to image)



            You need to setDisplayShowHomeEnabled
            and on the click you need to manage the drawer
            open and close drawer.



            Video link to your code







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 20 at 6:40

























            answered Nov 19 at 14:22









            Neerav

            465




            465












            • sadly didn't working, thanks anyway
              – Aldyro Wijaya
              Nov 19 at 14:33












            • I have added the video link. It is the same code to you have written above
              – Neerav
              Nov 20 at 6:42


















            • sadly didn't working, thanks anyway
              – Aldyro Wijaya
              Nov 19 at 14:33












            • I have added the video link. It is the same code to you have written above
              – Neerav
              Nov 20 at 6:42
















            sadly didn't working, thanks anyway
            – Aldyro Wijaya
            Nov 19 at 14:33






            sadly didn't working, thanks anyway
            – Aldyro Wijaya
            Nov 19 at 14:33














            I have added the video link. It is the same code to you have written above
            – Neerav
            Nov 20 at 6:42




            I have added the video link. It is the same code to you have written above
            – Neerav
            Nov 20 at 6:42


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376342%2fmy-navigationview-wont-show-in-drawerlayout-in-android-studio%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy