简体   繁体   中英

how do work with custome actionbar?

currently using API-21. want to use custome actionbar.

I tried this :

theme.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>

but android studio gives an error : work on 3.0 Or higher

any diffrent style for API-11?

my minimum sdk - 11 target sdk -21

this is my gradle:

android {
    compileSdkVersion 22
    buildToolsVersion '19.1.0'
    defaultConfig {
        applicationId ''
        minSdkVersion 11
        targetSdkVersion 21
        versionCode 1411005

    }

I am using this but it's working fine for me.

<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>

my Manifest:

    <uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="21" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM