簡體   English   中英

Android:Sherlock選項卡和ActionBar自定義

[英]Android: Sherlock Tabs and ActionBar customization

我需要有關操作欄和tabview定制的幫助。 我使用Sherlock ActionBar lib並嘗試將帶有Theme.Sherlock的自定義標簽/動作欄樣式綁定為我的活動的父項。 但是它沒有用,沒有錯誤,但是沒有任何改變。 我究竟做錯了什么?

這是我的樣式:(至少更改背景顏色):

<style name="AppBaseTheme" parent="Theme.Sherlock">
    <!--
        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. -->
    <item name="android:actionBarStyle">@style/MyActionBar</item>
    <item name="actionBarStyle">@style/MyActionBar</item>
    <item name="android:actionBarTabBarStyle">@style/MyActionBarTabBar</item>
    <item name="actionBarTabBarStyle">@style/MyActionBarTabBar</item>
    <item name="android:actionBarTabStyle">@style/MyActionBarTab</item>
    <item name="actionBarTabStyle">@style/MyActionBarTab</item>
</style>

<style name="MyActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">@android:color/white</item>
</style>

<style name="MyActionBarTabBar" parent="Widget.Sherlock.ActionBar.TabBar">
    <item name="android:background">@android:color/black</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_width">match_parent</item>
</style>

<style name="MyActionBarTab" parent="Widget.Sherlock.ActionBar.TabView">
    <item name="android:background">@android:color/white</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_width">wrap_content</item>
</style>

那是我的清單:

<application
    android:icon="@drawable/ic_launcher"
    android:logo="@drawable/abs__ic_go"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".FragmentTabsPager"
        android:label="@string/app_name"
        android:theme="@style/AppTHeme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

我試圖分別使用CUstomTabs和Theme.Styled(用於ActionBar)樣式,但沒有結果。

<style name="Widget.Sherlock.ActionBar.TabView" parent="Widget.Sherlock.ActionBar.TabView">

對於擴展的樣式,您不應使用相同的名稱。 Android應該如何知道選擇哪一個?

有效名稱將是包含您的主題名稱以供識別的名稱:

<style name="AppTheme.ActionBar.TabView" parent="Widget.Sherlock.ActionBar.TabView">

暫無
暫無

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

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