参考博客教程:
Demo下载:
效果图:
- mainActivity
- secondActivity
使用流程:
修改App的主题样式,styles.xml文件更改如下:
<!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style>
在activity.main中添加ToolBar,在ToolBar中加入常用的一些控件,文字,菜单…
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"