navigationview

Custom back button for NavigationView's navigation bar in SwiftUI

烈酒焚心 提交于 2019-12-03 11:38:56
I want to add a custom navigation button that will look somewhat like this: Now, I've written a custom BackButton view for this. When applying that view as leading navigation bar item, by doing: .navigationBarItems(leading: BackButton()) ...the navigation view looks like this: I've played around with modifiers like: .navigationBarItem(title: Text(""), titleDisplayMode: .automatic, hidesBackButton: true) without any luck. Question How can I... set a view used as custom back button in the navigation bar? OR: programmatically pop the view back to its parent? When going for this approach, I could

how to set unread notification count in NavigationView of DrawerLayout?

爷,独闯天下 提交于 2019-12-03 02:46:42
问题 I have created one NavigationView inside DrawerLayout using Android Design Support Library <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <!-- other views --> <android.support.design.widget.NavigationView android:id="@+id/navigation" android:layout_width

How to change the size of menu item icon in NavigationView?

房东的猫 提交于 2019-12-02 18:46:01
I have the following menu item: <item android:id="@+id/lock" android:checkable="true" android:title="@string/lock" > <menu > <item android:id="@+id/block_mess" android:checked="true" android:icon="@drawable/chantinnhan" android:title="@string/block_mess_string" /> <item android:id="@+id/block_call" android:checked="false" android:icon="@drawable/chancuocgoi" android:title="@string/block_call_string" /> <item android:id="@+id/lock_app" android:checked="false" android:icon="@drawable/khoaungdung" android:title="@string/lock_app_string" /> </menu> </item> ...there's still more but it's really

custom menu item size and textsize in navigation view

半世苍凉 提交于 2019-12-01 17:31:10
问题 I am using the code to customize height of text and row height in navigation view and it works on api21+ but the same code is not working in api 16. How can I make it work ? COde: Create a style and apply it to NavigationView using app:theme <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

Android DrawerLayout (with NavigationView) behind status bar

左心房为你撑大大i 提交于 2019-12-01 10:29:45
I have an app with a DrawerLayout that contains a NavigationView : activity_layout.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" android:id="@+id/drawer_layout" android:fitsSystemWindows="true"> <android.support.constraint.ConstraintLayout android:id="@+id/activity_list" android:layout_width="match_parent" android:layout_height=

Android DrawerLayout (with NavigationView) behind status bar

放肆的年华 提交于 2019-12-01 08:50:46
问题 I have an app with a DrawerLayout that contains a NavigationView : activity_layout.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" android:id="@+id/drawer_layout" android:fitsSystemWindows="true"> <android.support.constraint

Translucent StatusBar with dynamic ActionBar color in Android

好久不见. 提交于 2019-12-01 01:31:11
问题 I'm trying to realize a translucent statusbar (so that my navigation-view is BEHIND the statusbar) but still like to change the color of my actionbar dynamically. Because of this, the statusbar color needs to change to a darker version of my actionbar color. If I set my statusbar to transparent, as many sources suggest, my primary_dark color is used as the background of my statusbar. However, as I will change the actionbar color during runtime, primary_dark must not necessarily be the dark

How to add MenuItem to SubMenu in Google's new NavigationView?

喜夏-厌秋 提交于 2019-12-01 01:14:08
I have made an xml for my drawer menu which contains the following MenuItem: <item android:title="Contacts" android:id="@+id/contact_list"> <menu> </menu> </item> In my MainActivity I get a reference to the empty SubMenu and try to add a new test MenuItem to the the SubMenu. mNavMenu = mNavigationView.getMenu(); mNavMenu.findItem(R.id.contact_list).getSubMenu().add("hello"); Unfortunately, this is not working and the MenuItems are not being added. I have tried many other different variations of this but none of them update the SubMenu in my navigation drawer. Could this possibly be a bug? So

How to add MenuItem to SubMenu in Google's new NavigationView?

时光总嘲笑我的痴心妄想 提交于 2019-11-30 20:55:40
问题 I have made an xml for my drawer menu which contains the following MenuItem: <item android:title="Contacts" android:id="@+id/contact_list"> <menu> </menu> </item> In my MainActivity I get a reference to the empty SubMenu and try to add a new test MenuItem to the the SubMenu. mNavMenu = mNavigationView.getMenu(); mNavMenu.findItem(R.id.contact_list).getSubMenu().add("hello"); Unfortunately, this is not working and the MenuItems are not being added. I have tried many other different variations

Changing navigationView header text color

放肆的年华 提交于 2019-11-30 16:13:06
问题 How do you change the header text colors in navigation Drawer. I am using the latest support design library. Image is attached below. 回答1: Assuming you created it with a separate header xml file <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="178dp" android:background="@drawable/background_poly" android:orientation="vertical" android:weightSum="1"> <LinearLayout android