关于 ActionBar、ToolBar、StatusBar 的开发经验整理

一、ActionBar、ToolBar概述

1.1 ActionBar

1.2 ToolBar

1.3 StatusBar


StatusBar 是一个半透明阴影,View 可以伸展到其后面。

1.4 NavigationBar


NavigationBar 一般是纯黑不能使用的。Google 提供 NavigationBar 的透明与使用的可能,却没有推荐使用。个人觉得是为了给 Bottom navigation 做准备。这里不讨论 Bottom navigation 的优劣(我是 Bottom navigation 黑)。

1.5 兼容性

android从4.4开始,开始支持UI使用StatusBar与NavigationBar的范围。

二、沉浸式体验

三、使用实例

3.1 style 配置

在value中的styles.xml中设置:

在value-v19中的styles.xml中设置(为了兼容4.4)

在value-v21中的styles.xml中设置

原文地址:https://www.cnblogs.com/neillee/p/6417939.html