navigation-drawer

listPreferredItemHeightSmall is not working on api 16

夙愿已清 提交于 2019-12-22 14:08:27
问题 I am using the code below and it's working fine on api 23 but not on another device on api 16(Jelly Bean) . Style: <style name="NavigationViewStyle"> <item name="android:textSize">20sp</item> <!-- menu item text size--> <item name="android:listPreferredItemHeightSmall">40dp</item><!-- menu item height--> </style> And then, apply this style to NavigationView using app:theme <android.support.design.widget.NavigationView ... ... app:theme="@style/NavigationViewStyle" ... ... </android.support

listPreferredItemHeightSmall is not working on api 16

╄→尐↘猪︶ㄣ 提交于 2019-12-22 14:05:41
问题 I am using the code below and it's working fine on api 23 but not on another device on api 16(Jelly Bean) . Style: <style name="NavigationViewStyle"> <item name="android:textSize">20sp</item> <!-- menu item text size--> <item name="android:listPreferredItemHeightSmall">40dp</item><!-- menu item height--> </style> And then, apply this style to NavigationView using app:theme <android.support.design.widget.NavigationView ... ... app:theme="@style/NavigationViewStyle" ... ... </android.support

Android burger/arrow icon dynamic change color

爷,独闯天下 提交于 2019-12-22 09:59:54
问题 I want to change color of burger/arrow icon of navigation drawer. I know I can change it in styles, but I want change it dynamically in java. Did anybody know how to do this? 回答1: Using appcompat-v7:23.0.1 next code worked for me: int color = Color.parseColor("#FFEEEE00"); final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP); for (int i = 0; i < toolbar.getChildCount(); i++) { final View v = toolbar.getChildAt(i); if (v instanceof ImageButton) {

How to change color of text and icon of Sub-Menu attached to Navigation view?

回眸只為那壹抹淺笑 提交于 2019-12-22 08:24:25
问题 I am trying to figure out how I can change color of sub-menu items which is actually attached to navigation view. Following codes are actually from default template of Navigation Drawer which is available in android studio. activity_main_drawer.xml <?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/nav_camara" android:icon="@android:drawable/ic_menu_camera" android:title=

View Gone when clicked outside that view

和自甴很熟 提交于 2019-12-22 06:48:33
问题 I wanted to hide the view when clicking outside that view, for example, <Framelayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" > <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> <ImageView android:id="@+id/imgButtonToOpenGrid" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout

Permanent NavigationView loose focus after an item is selected

筅森魡賤 提交于 2019-12-22 05:55:00
问题 I started a project with a Navigation Drawer from the basic template of Android Studio. The only modification I made was to display it as permanent in order to have a tablet/TV layout. To achieve this, the only modification I made was in the xml layout. This allow the NavigationView to be always visible. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match

Navigation Drawer back button in fragments

北城以北 提交于 2019-12-22 05:19:25
问题 I started creating of app which use one activity (Navigation Drawer) and many fragments. But I unable to use toolbar back button to navigate back from fragments. Hardware back button works perfectly. I know that I need to override onOptionsItemSelected , catch android.R.id.home , check if there are something in back stack and than pop it. After changing fragment, "burger" button changes to "back arrow", but when I click on it onOptionsItemSelected never fired, just opens the NavigationDrawer

Don't display the overlay with the Android Navigation Drawer

烂漫一生 提交于 2019-12-22 04:00:59
问题 I was wondering if it's possible to remove the automatic overlay made by the recently implemented Navigation Drawer ? (The grey layer on the second picture) 回答1: You just need to set setScrimColor(int color) to your DrawerLayout : mDrawerLayout.setScrimColor(Color.WHITE); // OR mDrawerLayout.setScrimColor(Color.TRANSPARENT); Here is the official documentation from Android API: DrawerLayout - setScrimColor(). Hope this solves your problem! : ) 来源: https://stackoverflow.com/questions/18129598

Android Navigation Drawer Show Up Indicator for Lower Level Fragments

爱⌒轻易说出口 提交于 2019-12-22 03:25:28
问题 I have some issues switching navigation drawer functionality to up functionality at lower level fragment . I have read this thread to manage to show the up indicator. But when pressing the button, it'll open up the navigation drawer instead of going back to previous fragment. And I can't set action bar title in EditUserFragment to "Edit Profile". I'm using the navigation drawer template available in Android Studio. I have three levels: MainActivity with navigation drawer that consists of Home

Android ListView with images and text in Fragment

大憨熊 提交于 2019-12-22 00:26:13
问题 I createad a Navigation Drawer in Android Studio. Inside Fragment of Navigation Drawer I wanted to add a ListView with images and text.But after I running program and clicking on the fragment program crashing with text "Unfortunately, SerialMania has stopped ". What I'm doing wrong? package boiko.taisiia.com.serialmania; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.app.Fragment; import android.view.LayoutInflater; import android.view.View;