navigationview

NavigationView how to handle dynamic header content

梦想与她 提交于 2019-12-21 09:36:56
问题 I have a pretty standard NavigationView. When i use a static layout in the header like below it works perfect. <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_height="match_parent" android:layout_width="wrap_content" android:layout_gravity="start" android:fitsSystemWindows="true" app:headerLayout="@layout/nav_header" app:menu="@menu/drawer_view"/> But i want to have a dynamic header so thah i can change it when user logged in etc... So i tried to use a

Horiziontal recyclerview on DrawerLayout

落花浮王杯 提交于 2019-12-21 05:29:47
问题 This is my NavigationView 's layout <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/header" app:menu="@menu/meny" /> headerLayout has a horizontal RecyclerView which has some items that user can scroll on it. My problem is whenever I want to scroll in RecyclerView , drawerLayout is going to close . Is there any way to support horizontal

SwiftUI NavigationLink Hide Arrow

放肆的年华 提交于 2019-12-21 05:07:39
问题 Is there a way to hide the arrow to the right of the navigation link view that is automatically added? I want to show an image grid using NavigationView -> List -> HStack -> NavigationLink_1 - NavigationLink_2 The NavigationLinks have arrows and it looks weird 回答1: @State var selection: Int? = nil var body: some View { let navigation = NavigationLink(destination: Text("View"), tag: 1, selection: $selection) { EmptyView() } return VStack { navigation Text("Tap").onTapGesture { self.selection =

Positioning of actionLayout in navigation drawer

放肆的年华 提交于 2019-12-21 03:33:28
问题 I have the following setup: <android.support.design.widget.NavigationView style="@style/NavigationView" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:itemTextAppearance="@style/DrawerTextAppearance" app:menu="@menu/drawer"/> menu/drawer.xml <menu> <item android:id="@+id/messages_item" android:icon="@drawable/ic_notifications_neg" app:actionLayout="@layout/counter" android:title="@string/message_center"/> <item android:id="@+id

How to inflate android NavigationView with another menu dynamically during onClick?

☆樱花仙子☆ 提交于 2019-12-18 13:19:30
问题 Hi I have a NavigationView and there is an imageview in the headerview of that NavigationView. When I click on the imageview , NavigationView should inflate another menu resource file and replace current menu like in PlayStore app. I've tried this: imgIndic.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.e("Onclick","Arrow click"); navigationView.inflateMenu(R.menu.second_menu); } }); But when I click on the button, nothing happens! (Log Onclick

Add a ListView or RecyclerView to new NavigationView

梦想与她 提交于 2019-12-17 15:43:30
问题 I am using the new NavigationView from revision 22.2.0 of the support library by Google. It works perfectly fine to generate a navigation drawer populated using a menu res. I was wondering is it possible to add a ListView or RecyclerView to the navigation drawer so that it can be populated using my custom adapter code, which allows for far greater flexibility than menu resources. Here is my current XML: <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout android:id=

Default Navigation Drawer View to ExpandableListView

耗尽温柔 提交于 2019-12-17 10:55:12
问题 In Android Studio 2.1.2, if i create a default navigation activity I get this view: Which uses the following activity_main.xml file: <?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:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android

Change Navigation View Item Color Dynamically Android

ⅰ亾dé卋堺 提交于 2019-12-17 10:46:25
问题 I'd like to build a navigation drawer where each item has a different selection color (the icon tint and text color) as the google play store has: I'm not sure how they've solved this, I think they use different activities with different drawers. I want to use fragments and I want to change the icon tint and text color. Any ideas how I can do this? I'm using google's design support library and a drawer layout with a navigation view in there. 回答1: use app:itemIconTint in your NavigationView

How to set custom typeface to items in NavigationView?

人走茶凉 提交于 2019-12-17 07:03:12
问题 With the new NavigationView , we are able to set a drawer's items through a menu resource in XML. With that, we can set each item with something like <item android:id="@+id/drawer_my_account" android:icon="@drawable/ic_my_account" android:title="@string/drawer_my_account" /> But now, I want to set a custom typeface to each of those items in my drawer, and I could not find a way to do that, either by XML or by Java code. Is there a way to do it? 回答1: just add following class file to your

NavigationView menu items with counter on the right

亡梦爱人 提交于 2019-12-17 05:40:20
问题 The new NavigationView in the new Design Support Library works really great. They use " menu-items " to display the options. But how can I display a counter to the right of the menu item? Like in this picture: Or like in the GMail app. 回答1: Starting from version 23 of appcompat-v7 NavigationView supports action views, so it is quite easy to implement counter yourself. Create counter layout, i.e. menu_counter.xml : <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas