java - menu layout for the navigation menu is not showing up in the navigation drawer -
it's hard figure out problem because there no syntax errors. i'm able slide navigation menu, menu layout not working.
here's code.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <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:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.isaacdixon.pro3.mainactivity"> <linearlayout android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" > <include android:layout_height="wrap_content" android:layout_width="match_parent" layout="@layout/toolbar_layout" /> </linearlayout> <android.support.design.widget.navigationview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/navigation_view" android:layout_gravity="start" app:menu="@menu/drawer_menu" /> </android.support.v4.widget.drawerlayout>
mainactivity.java
package com.example.isaacdixon.pro3; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.support.v7.widget.toolbar; public class mainactivity extends appcompatactivity { toolbar toolbar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar = (toolbar)findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); } }
drawer_menu.xml
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkablebehavior="single"> <items android:id="@+id/home_id" android:title="home" android:icon="@drawable/glass" ></items> <items android:id="@+id/messege_id" android:title="messege" android:icon="@drawable/draw" ></items> <items android:id="@+id/setting_id" android:title="setting" android:icon="@drawable/settings" ></items> </group> <item android:title="social"> <menu> <items android:id="@+id/facebook_id" android:title="facebook" android:icon="@drawable/facebook" > </items> <items android:id="@+id/twiter_id" android:title="twiter" android:icon="@drawable/twitter" > </items> </menu> </item> </menu>
problem items
.
just edit menu below.
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkablebehavior="single"> <item android:id="@+id/..." android:icon="@android:drawable/..." android:title=.../> <item android:id="@+id/... android:icon="@android:drawable/..." android:title="..."/> <item android:id="@+id/..." android:icon="@android:drawable/..." android:title="..."/> <item android:id="@+id/..." android:icon="@android:drawable/..." android:title="..."/> </group> <item android:title="social"> <menu> <item android:id="@+id/..." android:icon="@android:drawable/..." android:title="..."/> <item android:id="@+id/..." android:icon="@android:drawable/..." android:title="..."/> </menu> </item> </menu>
Comments
Post a Comment