简体   繁体   中英

Action bar custom view

I want to declare a custom view, BUT I also want the home logo with up icon to appear on the left with its default functionality. How can I achieve to use both?

Best way is to use XML styles:

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

Then simply set this theme as either the application theme or activity them in AndroidManifest.xml

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