1.Toolbar的用法
1.1关于标题栏的那些事
每个应用都有默认的标题栏
在AdroidManifest.xml中:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">//在这个样式中,就有关于标题栏的
....
在/values/style.xml中
<resources>
<!-- Base application theme. -->
<style name="AppTheme"
//默认的标题栏
parent="Theme.AppCompat.Light.DarkActionBar">
//这里是关于标题栏画面的一些属性
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>//标题栏颜色
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>//状态栏颜色