android状态栏着色

今天学习了一篇非常不错的关于Android状态栏着色的文章,文章见http://www.jianshu.com/p/bae25b5eb867
这篇文章为我们提供了三种状态栏着色的方法,这里我就不详细说了,看文章就好。
但我这里想要记录一下的不只是关于状态栏着色的问题,而是这篇文章demo中用到了的Android6.x的新控件NavigationView与DrawerLayout以及Toolbar的配套使用,达到非常不错的导航栏效果,并且使用起来也是非常的简单易用。代码示例如下:

<?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"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:paddingTop="@dimen/padding_top"
            android:theme="@style/AppTheme.AppBarOverlay" />

        <ListView
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </LinearLayout>

    <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/nav_head_main"
        app:menu="@menu/menu_drawer" />

</android.support.v4.widget.DrawerLayout>

demo地址见:https://github.com/love-311/StatusBarColor,感兴趣的可以自行下载研究一下。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值