navigation-drawer

Navigation Component, Control when to show hamburger or back icon

 ̄綄美尐妖づ 提交于 2019-11-27 01:20:39
问题 I have the following Activity class MainActivity : AppCompatActivity() { private lateinit var drawerLayout: androidx.drawerlayout.widget.DrawerLayout override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.main_activity) drawerLayout = drawer_layout val navController = Navigation.findNavController(this, R.id.fragment_main_navHost) setSupportActionBar(toolbar) NavigationUI.setupActionBarWithNavController(this, navController, drawerLayout)

Android: 2 or more ExpandableListView inside Navigation Drawer

假如想象 提交于 2019-11-27 00:52:09
How could I do something like this? Two expandable listview inside navigation drawer. I tryed to add it inside my xml but without luck. What I want is a view with only one scrollbar, but I don't' know how to do it.. this is my navigation drawer layout: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:background="@color/Bianco" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:orientation="vertical"

Blur background of Navigation Drawer

↘锁芯ラ 提交于 2019-11-27 00:48:56
问题 How would I go about create a live blur on a Navigation Drawer, so when you pull out the drawer the background of the list is blurred background of the fragment displayed behind it? I have looked but mainly found BitMap blurs, and nothing that is live. 回答1: The process involves the following stages: Get a snapshot of the whole drawer layout. Crop it to the exact size of your menu. Downscale it quite a bit (a factor of 8 is pretty good). Blur that image. Have a custom view that displays part

How to replace the hamburger icon used for ActionBarToggle on Android Toolbar with a custom drawable?

混江龙づ霸主 提交于 2019-11-27 00:35:45
问题 I have implemented a basic ActionBarDrawerToggle using the new Toolbar in Android 5.0. However, I am unable to figure out how to change the default hamburger icon that is supplied. From the android documentation it says that "the given Activity will be linked to the specified DrawerLayout and the Toolbar's navigation icon will be set to a custom drawable... This drawable shows a Hamburger icon when drawer is closed and an arrow when drawer is open. It animates between these two states as the

How can I change separator color in NavigationView?

淺唱寂寞╮ 提交于 2019-11-27 00:20:12
I'm trying to use NavigationView to implement NavigationDrawer. I have added the separator by setting group id in menu. However I can't see the separator. I guess it is because the separator color is same as the background. So I want to change the separator color. But I find no way to change it. Can anyone help me? In screenshot, it seems have a room for separator between History and Settings , but you can't see it. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http:/

How to programmatically add a submenu item to the new material design android support library

一曲冷凌霜 提交于 2019-11-27 00:05:46
I am trying to add new menu items to a submenu in the new Material Design drawer panel. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> ... <android.support.design.widget.NavigationView android:id="@+id/main_navigation" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout

DrawerLayout's item click - When is the right time to replace fragment?

为君一笑 提交于 2019-11-26 23:56:44
问题 I'm developing an application which uses the navigation drawer pattern (With DrawerLayout). Each click on a drawer's item, replaces the fragment in the main container. However, I'm not sure when is the right time to do the fragment transaction? When the drawer starts closing? Or after it is closed? In google's documentaion example, you can see that they are doing the transaction right after the item click, and then close the drawer. As a result, the drawer seems laggy and not smooth, and it

make main content area active in DrawerLayout

六眼飞鱼酱① 提交于 2019-11-26 23:18:12
问题 How to make active main content area, while drawer is open. Currently, if main content area is clicked, drawer will be closed then touch event will be dropped, I want to catch that touch event and pass it to main content area. 回答1: You need to create custom DrawerLayout and @overide onInterceptTouchEvent . Then you can create some method for registering drawer views (like setDrawerViewWithoutIntercepting ), for which will be possible to use (click) main content, when are open. You should call

Why does DrawerLayout sometimes glitch upon opening?

巧了我就是萌 提交于 2019-11-26 22:33:40
问题 I have followed the tutorial Navigation Drawer and everything works like a charm except for a small glitch. I'll try to explain it as much as possible, and if it still isn't clear, I'll try to upload a video of the problem. Problem happens when trying to open the drawer and only when opening, and only happens sometimes, not always. That is when I start to open it it glitches and freezes with about 4 millimeters open, and always the same distance. It then would not continue opening nor close

NavigationView menu items with counter on the right

只谈情不闲聊 提交于 2019-11-26 21:39:09
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. 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.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent"