簡體   English   中英

我的情況下的操作欄自定義樣式

[英]Action bar custom style in my case

我正在使用Android本機操作欄。 我想將自己的可繪制資源添加為操作欄的背景。 因此,我做了一個如下主題:

res / values / themes.xml:

<style name="Theme.MyStyle" parent="android:style/Theme.Holo.Light">
    <item name="android:background">@drawable/my_bg</item>
</style>

然后,在AndroidManifest.xml文件中,將此樣式添加到我的應用程序中:

<application
        android:debuggable="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"

        android:theme="@style/Theme.MyStyle"
        >
   <activity ...>
   <activity .../>
   ...

</application>

背景繪制不僅適用於操作欄適用於所有碎片的內容。 為什么?

我的第二個問題是,如何自定義溢出圖標和操作欄上最左側的“向上”按鈕?

嘗試

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="Theme.MyStyle" parent="@android:style/Theme.Holo">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <!-- other activity and action bar styles here -->
    </style>

    <!-- style for the action bar backgrounds -->
    <style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
        <item name="android:background">@drawable/ab_background</item>
        <item name="android:backgroundStacked">@drawable/ab_background</item>
        <item name="android:backgroundSplit">@drawable/ab_split_background</item>
    </style>
</resources>

使用setDisplayUseLogoEnabled(boolean) 自定義徽標

更多信息

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM