android-navigationview

Implementing proper back navigation and home button handling using Toolbar in Android

混江龙づ霸主 提交于 2019-12-04 07:46:30
问题 I am using a single activity and multiple fragments(screenshot attached) within the same activity to provide a seamless navigation. But after implementing the latest toolbar and navigation view, it seems hard to handle the navigation and home buttons. I am having trouble with the following things. Managing the Hamburger/Back button at left top. Toggling the icon and functionality to Menu and Back nav. Page title - Changing the page titles whenever a fragment in pushed and popped. I have tried

Disable a color tint in NavigationView only for specified icons

一笑奈何 提交于 2019-12-04 01:50:41
I need to disable a tint color for some icons in NavigationView because their color define category type. How can I do it? Below picture shows my problem: Robert Banyai navview.setItemIconTintList(null); Good luck! Android Geek If you want change color of icon on seletion the below is the possible answer: Change Navigation View Item Color Dynamicly Android Otherwise you can set navview.setItemIconTintList(null); this will give the original colors of icons. and you can use colored and grey icons as per your requirements. Menu menuNav = navigationView.getMenu(); MenuItem menuItem = menuNav

How to add draggable icon with navigation drawer

耗尽温柔 提交于 2019-12-03 13:37:14
My problem: I want to add draggable icon in navigation drawer. This icon combined with listview of navigation drawer when drawer open. see similar like this, What I have tried, I searched in StackOverflow like similar question this, Draggable drawer with a handle (instead of action bar) on top of other apps But all answer suggest to 3rd party library. My question 1.It`s possible to add draggable icon with navigation drawer? For drag layout there is github library which is useful for it You can drag from left to right or any where. It will also slide from left to right & also drag is also

Add badge counter to hamburger navigation menu icon in Android

喜你入骨 提交于 2019-12-03 03:13:32
问题 My question is the same as this question (which is not a duplicate of this question). The only answer to that question does not work for me as, rather than changing the default hamburger icon to the left of the activity's title, it just adds an additional hamburger icon to the right of my activity's title. So how do I actually get this: I've been poking around at it all day, but have got nowhere. I see that Toolbar has a setNavigationIcon(Drawable drawable) method. Ideally, I would like to

How can I get menu item in NavigationView?

試著忘記壹切 提交于 2019-12-03 01:01:36
<android.support.design.widget.NavigationView android:id="@+id/drawer_nav" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" android:theme="@style/Theme.AppCompat.Light.NoActionBar" app:headerLayout="@layout/drawer_header" app:menu="@menu/menu_drawer" /> I am using android.support.design.library for material design. What I want is to hide some menu items when the user is not logged-in. Now I have trouble to get the menu item in NavigationView . I have tried: MenuItem logoutItem = (MenuItem) mNavigationView.findViewById(R.id.menu_logout);

Implementing proper back navigation and home button handling using Toolbar in Android

时间秒杀一切 提交于 2019-12-02 16:21:38
I am using a single activity and multiple fragments(screenshot attached) within the same activity to provide a seamless navigation. But after implementing the latest toolbar and navigation view, it seems hard to handle the navigation and home buttons. I am having trouble with the following things. Managing the Hamburger/Back button at left top. Toggling the icon and functionality to Menu and Back nav. Page title - Changing the page titles whenever a fragment in pushed and popped. I have tried several things like overriding onBackPressed(), setHomeAsUpIndicator, popping fragments manually.

Add badge counter to hamburger navigation menu icon in Android

大兔子大兔子 提交于 2019-12-02 15:17:21
My question is the same as this question (which is not a duplicate of this question ). The only answer to that question does not work for me as, rather than changing the default hamburger icon to the left of the activity's title, it just adds an additional hamburger icon to the right of my activity's title. So how do I actually get this: I've been poking around at it all day, but have got nowhere. I see that Toolbar has a setNavigationIcon(Drawable drawable) method. Ideally, I would like to use a layout (that contains the hamburger icon and the badge view) instead of a Drawable , but I'm not

Navigation View Global Action Back State

六眼飞鱼酱① 提交于 2019-12-02 09:04:30
问题 I have been messing with the Jetpack Navigation component, and I created an activity that uses a navigation drawer. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val navigationController = findNavController(R.id.navigationHostFragment) navigationView.setupWithNavController(navigationController) val appBarConfiguration = AppBarConfiguration(TOP_LEVEL_DESTINATIONS,

Navigation View Global Action Back State

久未见 提交于 2019-12-02 06:53:51
I have been messing with the Jetpack Navigation component, and I created an activity that uses a navigation drawer. class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val navigationController = findNavController(R.id.navigationHostFragment) navigationView.setupWithNavController(navigationController) val appBarConfiguration = AppBarConfiguration(TOP_LEVEL_DESTINATIONS, drawerLayout) toolbar.setupWithNavController(navigationController, appBarConfiguration) } override fun

Fixed navigation header in navigation drawer while scrolling through items

雨燕双飞 提交于 2019-12-01 10:33:23
CURRENT STATE : NavigationDrawer with a NavigationHeader and NavigationMenu items. The items are large in number so scrolling is required in order to access the items towards the bottom. REQUIREMENT : When scrolling down to the bottom, the NavigationHeader should stay fixed Here's my activity_main layout file <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=