NavigationView的使用
代码已经分享至github:https://github.com/YanYoJun/NavigationDemo
转载请注明原文链接:http://www.cnblogs.com/yanyojun/p/8076015.html
一、直接看布局
<?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:fitsSystemWindows="true"
tools:openDrawer="start"> <include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" /> <android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" /> </android.support.v4.widget.DrawerLayout>
额,其实就这么点东西,其他也没有什么,在DrawerLayout中嵌套一个NavigationView就可以了
这里有一个fitSystemWindow,这句话总结的很好:
fitsSystemWindow 默认是true,就是组件都在屏幕内,但是不包括statusBar。设置成false后,整个屏幕都可以放置组件,没有statusBar和window之分。
NavigationView的使用的更多相关文章
- Android Material Design之 NavigationView侧滑界面自定义 随笔
一.侧滑界面Menu自定义: 在menu文件夹下新建activity_main_drawer.xml文件,自定义标题和icon: <?xml version="1.0" en ...
- 安卓Design之NavigationView的使用
前面讲解了Design包下的TabLayout的使用,下面将带来NavagationView和DrawLayout以及toolbar的联动. 项目已经同步至:https://github.com/na ...
- DrawerLayout 和 NavigationView 的使用
参考: 1.NavigationView 的使用 2.NavigationView更改菜单icon和title颜色变化效果 3.Android 自己实现 NavigationView 转了第一篇 ...
- 【Android】NavigationView头部点击监听事件
AndroidStudio给出的模板里面只有列表点击事件,即实现OnNavigationItemSelectedListener中的onNavigationItemSelected方法,根据item的 ...
- navigationView 的使用和布局文件的绑定
今天项目进行到了细化内容的部分啦- 需要美化侧滑菜单,并且填充数据.在博客上看了好久发现大家的都大同小异 而且很少有提到如何绑定内容各处求助终于在一片博客上发现了蛛丝马迹!!上大神的帖子:blog.c ...
- Android M 控件:Snackbar、Toolbar、TabLayout、NavigationView
Snackbar Snackbar提供了一个介于Toast和AlertDialog之间轻量级控件,它可以很方便的提供消息的提示和动作反馈.Snackbar的使用与Toast的使用基本相同: Snack ...
- android-android获取navigationview 上的控件id
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); View headerView = navi ...
- 可折叠的ToolBar+抽屉菜单NavigationView+浮动按钮FloatButton
使用Material Design风格的ToolBar和抽屉导航 先看个简单的运行效果 主要记录下布局的写法 1 用到的Google Design依赖和V7包依赖 compile 'com.andro ...
- 【转】Android M新控件之AppBarLayout,NavigationView,CoordinatorLayout,CollapsingToolbarLayout的使用
Android M新控件之AppBarLayout,NavigationView,CoordinatorLayout,CollapsingToolbarLayout的使用 分类: Android UI ...
- ToolBar+DrawerLayout + NavigationView
http://www.jianshu.com/p/9471b87f2c61 很好的博客可以瞅瞅 <android.support.design.widget.NavigationView and ...
随机推荐
- Java经常使用日期操作具体解释
Date类型大多数时间分量计算方法已经被Calendar代替 Date经常用法setTime getTime() new Date();默认获取当前的时间 SimpleDateFormat用来格式化和 ...
- MD5加密解密帮助类
using System; using System.Security.Cryptography; using System.Text; namespace Maticsoft.DBUtility { ...
- 【solr专题之中的一个】Solr高速入门
一.Solr学习相关资料 1.官方材料 (1)高速入门:http://lucene.apache.org/solr/4_9_0/tutorial.html.以自带的example项目高速介绍发Solr ...
- github远程仓储和本地仓储进行关联
我们使用github作为远程仓储,需要提前注册号一个github账号 由于github仓储和本地仓储之间传输是使用ssh加密的,所以需要一点设置, 1.创建sshkey gitbash执行: ssh ...
- XML中的CDATA是什么?PCDATA是什么?
PCDATA表示已解析的字符数据. 在CDATA内部的所有内容都会被解析器忽略.
- mysql 查看编码方式
一. 查看数据库的字符集 show variables like 'character\_set\_%'; 输出: +--------------------------+--------+ | Va ...
- Knn算法C++实现
相对简单的模拟.C++11 /* *********************************************** Author :guanjun Created Time :2016/ ...
- pybot执行多条用例时,某一个用例执行失败,停止所有用例的执行
问题: pybot执行多条用例时,某一个用例执行失败,停止所有用例的执行 解决办法: pybot -exitonfailure E:\robot\呼送项目\测试用例\基本流程\主流程.txt 参考文章 ...
- spring boot+mybatis报错mapper无法注入
搭建spring boot项目时启动出现的问题,先来看异常片段: Error starting ApplicationContext. To display the conditions report ...
- maven-将依赖的 jar包一起打包到项目 jar 包中
前言: 有时候在项目开发中,需要很多依赖的 jar 包,其中依赖的 jar 包也会依赖其他的 jar 包,导致jar 包的管理很容易不全,以下有两种方法可以规避这个问题. 一.在pom.xml 文件中 ...