简体   繁体   中英

CustomNavigationLayout for Appcompat theme through styles

I have read the post to set the customNavigationLayout for Holo theme. Is there any similar thing for appcompat(Theme.AppCompat.Light.DarkActionBar)?

<style name="Theme.Main" parent="android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/Widget.ActionBar</item>
</style>

<style name="Widget.ActionBar" parent="android:Widget.Holo.Light.ActionBar">
    <item name="android:displayOptions">showHome|useLogo|showCustom</item>
    <item name="android:customNavigationLayout">@layout/custom</item>
</style>

Try this:

<style name="Theme.Main" parent="@style/Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/Widget.ActionBar</item>
</style>

<style name="Widget.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="android:displayOptions">showHome|useLogo|showCustom</item>
    <item name="android:customNavigationLayout">@layout/custom</item>
</style>

you can set it in the android manifest

AndroidManifest.xml:

<activity android:name="com.example.Activity1"
      android:theme="@style/CustomActionBarTheme"
/>

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