android-navigationview

How to implement the navigation drawer in android with sub item menu [duplicate]

半世苍凉 提交于 2020-01-07 09:04:02
问题 This question already has answers here : How to open sub menu after click on menu-item in Navigation drawer? (3 answers) Closed 4 years ago . I am new in android and in my project I want to add the navigation drawer. I am selecting Navigation Drawer activity and create project in eclipse please help me how to develop navigation drawer below Here is the image of navigation drawer for item and sub item menu 回答1: Use NavigationView <android.support.design.widget.NavigationView android:id="@+id

How to fix this error? Error inflating class android.support.design.widget.NavigationView

帅比萌擦擦* 提交于 2020-01-05 07:08:59
问题 LOGCAT E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.batyaa.first_gear_automotive, PID: 2582 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.batyaa.first_gear_automotive/com.example.batyaa.first_gear_automotive.HomeActivity}: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class android.support.design.widget.NavigationView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java

How to fix this error? Error inflating class android.support.design.widget.NavigationView

前提是你 提交于 2020-01-05 07:08:12
问题 LOGCAT E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.batyaa.first_gear_automotive, PID: 2582 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.batyaa.first_gear_automotive/com.example.batyaa.first_gear_automotive.HomeActivity}: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class android.support.design.widget.NavigationView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java

Java.lang.NoClassDefFoundError Issue when using Android Support Design NavigationView

怎甘沉沦 提交于 2020-01-03 09:07:16
问题 Getting the following issue when using NavigationView on a app: java.lang.NoClassDefFoundError: android.support.design.internal.NavigationMenuPresenter I got the same issue in this sample project: https://github.com/xamarin/monodroid-samples/tree/master/android5.0/Cheesesquare Test: Android 5.1 Extra information: ===================== Xamarin Studio Version 5.10.1 (build 6) Installation UUID: 4f372b0c-765f-463b-9408-1bd0211e4e94 Runtime: Mono 4.2.1 (explicit/6dd2d0d) GTK+ 2.24.23 (Raleigh

How to programmatically set the margin between icon and title of menu item of Navigation Drawer in Android?

时光毁灭记忆、已成空白 提交于 2020-01-03 05:42:06
问题 I am developing an Android App. In my app, I am using navigation drawer and navigation view. But I set the menu item for them programmatically. For a menu item, I set both icon and title. But I am having a problem with that. That is I cannot set the spacing between icon and title that I programmatically added to menu. This is how I programmatically add item to menu Menu menu = leftDrawer.getMenu(); SubMenu subMenu = menu.addSubMenu(MAIN_MENU_ITEM_GROUP_ID, 99, 99, "Others"); subMenu.add(MAIN

onNavigationItemSelected not working in NavigationView

耗尽温柔 提交于 2020-01-02 22:12:01
问题 Please can someone help me with fragments from the navigation drawer, for some reason I can't get them to work and all the code looks right. Here is the link to the source code. 回答1: Have a look at your MainActivity.java . You have implemented the callbacks for NavigationView.OnNavigationItemSelectedListener in MainActivity as below, @Override public boolean onNavigationItemSelected(MenuItem menuItem) { // blah blah } Also check the setupDrawerContent method. private void setupDrawerContent

Class Not Found Android Support Design Widget NavigationView

核能气质少年 提交于 2020-01-02 02:48:06
问题 Good day, can you help me out. I got this error when compiling/running my code on an emulator. This is the sample tutorial I used to make. I used min Target API - 15 and compile the latest gradle 'com.android.support:design:23.0.0' http://www.android4devs.com/2015/06/navigation-view-material-design-support.html Code Error: AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eccp.projects.ecosavers.ecosavers/com.eccp.projects.ecosavers.ecosavers.activities

How to change the navigation icon color

和自甴很熟 提交于 2019-12-31 05:40:12
问题 I have a navigationView in my app and after add two lines in app style : <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> The Navigation icon color changed to black and for this problem i added this line in style : <item name="android:textColorSecondary">@android:color/white</item> Now navigation icon is white again but now i have a new problem . With above code , the title of navigation items is change color too. I didn't find a solution to this Interference

How to set a long click listener on a MenuItem (on a NavigationView)?

守給你的承諾、 提交于 2019-12-28 20:36:14
问题 How can I set a long click listener on a MenuItem ? I tried this answer, but the method doesn't exist for me. Any solutions? Code: Menu menu = navigationView.getMenu(); MenuItem menuItem = menu.findItem(R.id.menu_item); // TODO set a long click listener on the menuItem. menuItem.setOnLongClickListener(...); // Method does not exist, any other solutions? Edit: I don't want to set a custom ActionView, I want the long click listener to the whole MenuItem , without a custom View. 回答1: one of many

How to set a long click listener on a MenuItem (on a NavigationView)?

耗尽温柔 提交于 2019-12-28 20:35:51
问题 How can I set a long click listener on a MenuItem ? I tried this answer, but the method doesn't exist for me. Any solutions? Code: Menu menu = navigationView.getMenu(); MenuItem menuItem = menu.findItem(R.id.menu_item); // TODO set a long click listener on the menuItem. menuItem.setOnLongClickListener(...); // Method does not exist, any other solutions? Edit: I don't want to set a custom ActionView, I want the long click listener to the whole MenuItem , without a custom View. 回答1: one of many