目前使用 API-21。想使用客户操作栏。
我试过这个:
主题.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomActionBarTheme"
parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar"
parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#00ffcc</item>
<item name="background">@drawable/actionbar_background</item>-->
</style>
</resources>
但 android studio 报错:work on 3.0 Or higher
API-11 有什么不同的风格吗?
我的最小 SDK - 11 目标 sdk -21
这是我的gradle:
android {
compileSdkVersion 22
buildToolsVersion '19.1.0'
defaultConfig {
applicationId ''
minSdkVersion 11
targetSdkVersion 21
versionCode 1411005
}
最佳答案
我正在使用它,但它对我来说工作正常。
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
我的 list :
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="21" />
关于java - 如何使用自定义操作栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31135227/