Action bar custom view

后端 未结 1 716
我寻月下人不归
我寻月下人不归 2020-12-08 03:40

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?

相关标签:
1条回答
  • 2020-12-08 04:05

    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

    0 讨论(0)
提交回复
热议问题