Android ActionBar使用经验
2017-06-26 18:37
281 查看
一 ActionBar的覆盖叠加
1 在使用覆盖时代码中要继承Activitym
2 自定义style
效果
二 在使用ActionBar时会出现2种情况style
第一种是系统的 例如:
第二种是兼容的 例如v7库下的 :
比较明显的是没有@android: 类的继承是AppCompatActivity,
(如果系统的style的的使用了AppCompatActivity继承,则会出现Java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.)
第三种是自定义style: 这里偷个懒就不加说明了, 如果对于上边2种了解的话,要自己定义style还是比较容易的;
1 在使用覆盖时代码中要继承Activitym
2 自定义style
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.NoActionBar"> <item name="android:windowActionBarOverlay">true</item> <!-- 兼容支持库 --> <item name="windowActionBarOverlay">true</item> <item name="android:actionBarStyle">@style/TranslucentActionBar</item> <item name="android:windowTranslucentStatus">true</item> </style> <style name="TranslucentActionBar" parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse"> <item name="android:background">@null</item> </style>
效果
二 在使用ActionBar时会出现2种情况style
第一种是系统的 例如:
<application android:theme="**@android:**style/Theme.Holo.Light" ... />比较明显的是加入了@android: ,类的继承是activity
第二种是兼容的 例如v7库下的 :
<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
比较明显的是没有@android: 类的继承是AppCompatActivity,
(如果系统的style的的使用了AppCompatActivity继承,则会出现Java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.)
第三种是自定义style: 这里偷个懒就不加说明了, 如果对于上边2种了解的话,要自己定义style还是比较容易的;
相关文章推荐
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(下)
- ActionBar使用方法 - Android活动栏(二)
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(上)
- Android ActionBar使用方法(二)
- Android ActionBar使用方法(一)
- Android ActionBar使用介绍
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(下)
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(上)
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(下)
- android actionbar中share使用、图片详细信息获取
- android action-bar的使用
- Android ActionBar使用方法(二)
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(上)
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(下)
- Android ActionBar使用方法
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(下)
- Android ActionBar使用介绍
- Android ActionBar使用方法(一)
- Android ActionBar完全解析,使用官方推荐的最佳导航栏(上)
- android ActionBar的使用