drawerlayout

toolbar.setNavigationOnClickListener not working

北慕城南 提交于 2020-08-24 05:30:48
问题 toolbar.setNavigationOnClickListener this function is not working have no clue why. activity_main.xml Layout <android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true" tools:context=".login.LoginActivity"> <android.support.design.widget

浅谈DrawerLayout(抽屉效果)

 ̄綄美尐妖づ 提交于 2020-04-01 08:33:55
DrawerLayout是V4包下提供的一种左滑右滑抽屉布局效果。 实现效果如下: 因为是官方提供的,所以使用起来也相对的比较简单。 DrawerLayout 提供 1、当界面弹出的时候,主要内容区会自动背景变黑,当点击内容区的时候,抽屉布局会消失 2、在屏幕边缘手势滑动 会拉出抽屉布局 注意:当按后退键的时候,如果抽屉布局正在显示,则需要关闭抽屉布局 用一个简单的Demo介绍下: -------------------------------------------------------------------------------------------- 首先布局文件: 布局分为三部分,左中右。中间的是APP显示的主要内容区,然后看你个人的需求来选择是要左边弹出布局,还是右边弹出布局。 如果选择是左边弹出界面还是右边弹出界面,只要给弹出界面设设置 android:layout_gravity="left" 或者 android:layout_gravity="right" 就可以了 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 xmlns:tools="http://schemas.android.com/tools" 3 android:layout_width=

Creating a Navigation Drawer 创建一个导航侧边栏

半腔热情 提交于 2020-02-21 17:03:02
The navigation drawer is a panel that displays the app’s main navigation options on the left edge of the screen. It is hidden most of the time, but is revealed when the user swipes a finger from the left edge of the screen or, while at the top level of the app, the user touches the app icon in the action bar. //导航抽屉是一个显示在屏幕左边的应用的主要的用于导航的选项面板。它大多数时间是隐藏的,但是当用户从屏幕左边清扫或者点击了action bar上的应用图标时,导航抽屉将会出现 This lesson describes how to implement a navigation drawer using the DrawerLayout APIs available in the Support Library . Navigation Drawer Design Before you decide to use a navigation drawer in your

Material Design学习(二)——滑动菜单

瘦欲@ 提交于 2020-02-20 17:58:03
拷贝一份昨天的项目,并改名 day20_SlidingMenu 一、 DrawerLayout 抽屉布局 DrawerLayout 是个抽屉布局,可以放入两个子控件。第一个子控件是主屏幕显示的内容,第二个子控件是滑动菜单中显示的内容 主布局: <?xml version="1.0" encoding="utf-8"?> < androidx.drawerlayout.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 " > < FrameLayout android: layout_width = " match_parent " android: layout_height = " match_parent " > < androidx.appcompat.widget.Toolbar android: id = " @

DrawerLayout主内容写在其他内容前面

江枫思渺然 提交于 2020-02-17 06:45:25
< ? 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/drlay_main" android : layout_width = "match_parent" android : layout_height = "match_parent" tools : context = "com.wangbaomin.mri.MainActivity" > < RelativeLayout android : layout_width = "match_parent" android : layout_height = "match_parent" android : layout_centerHorizontal = "true" android : gravity =

Android Navigation Icon - Profile picture instead of hamburger icon

自闭症网瘾萝莉.ら 提交于 2020-02-06 08:19:46
问题 I'm trying to find how to change the hamburger icon that opens the navigation drawer to some custom image that can be loaded with Picasso or something like that. Just like in the image above, where Twitter managed to put my profile picture replacing the hamburger icon they had before. I couldn't find anything like this here and I don't have a clue about how to do it. If anyone got a sample or some guidance on how to do it, I would really appreciate it. EDIT Some of my Activity's code:

Android Navigation Icon - Profile picture instead of hamburger icon

[亡魂溺海] 提交于 2020-02-06 08:19:23
问题 I'm trying to find how to change the hamburger icon that opens the navigation drawer to some custom image that can be loaded with Picasso or something like that. Just like in the image above, where Twitter managed to put my profile picture replacing the hamburger icon they had before. I couldn't find anything like this here and I don't have a clue about how to do it. If anyone got a sample or some guidance on how to do it, I would really appreciate it. EDIT Some of my Activity's code:

Remove scrollbar from android support design navigation drawer?

断了今生、忘了曾经 提交于 2020-02-01 17:25:46
问题 I just updated the support design library from 22.2.1 to 23.0.1 and immediately noticed the presence of a scrollbar in the navigation drawer. I tried to use android:scrollbars="none" But that didn't fix it. Is there any other way to remove the scrollbar? 回答1: Unfortunately the scrollbar is set in the NavigationMenuView layout not in the NavigationView , for this reason if you use android:scrollbars="none" the scrollbar is still present. You can do it programmatically calling this method: