2016-03-12 49 views
1

根據設備的API級別,我的應用的操作欄中的圖標顏色不同。我希望他們在所有設備上看起來都一樣。ActionBar中圖標的不同顏色

這是它的外觀在API 23,這是我希望它是在所有的設備:

This is how it looks in API 23, which is how I want it to be

,這是它的外觀在舊版本:

enter image description here

我有以下styles.xml:

值/風格。 XML

<style name="MyMaterialTheme" parent="MyMaterialTheme.Base"> 

</style> 

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <item name="windowNoTitle">true</item> 
    <item name="windowActionBar">false</item> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

V21/styles.xml

<style name="MyMaterialTheme" parent="MyMaterialTheme.Base"> 
    <item name="android:windowContentTransitions">true</item> 
    <item name="android:windowAllowEnterTransitionOverlap">true</item> 
    <item name="android:windowAllowReturnTransitionOverlap">true</item> 
    <item name="android:windowSharedElementEnterTransition">@android:transition/move</item> 
    <item name="android:windowSharedElementExitTransition">@android:transition/move</item> 
</style> 

這是動作條的佈局:

... 
<android.support.v7.widget.Toolbar 
     android:id="@+id/my_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     android:elevation="4dp" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> 
... 

,這是我的Manifest.xml

<application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:name="com.martinez.mario.rutapp.base.RutappApplication" 
     android:theme="@style/MyMaterialTheme" > 

的一部分,怎樣才能讓箭頭和溢流圖標看起來白中的所有設備?

謝謝。

+0

我剛剛意識到它對我的應用程序是一樣的。 +1 –

+0

奇怪的是,我最近寫了一個應用程序,它在

回答

2

你可能碰上程序兼容性支持庫23.2.0一個bug,更新到23.2.1或能夠與使用支持向量可繪製的:在23.2.0

vectorDrawables.useSupportLibrary = true 

程序兼容性推出的一代如果啓用了矢量支持drawables,問題在於appcompat本身利用了這一點並且也使用了它,但是這需要啓用vector drawables生成。它自己的用法在23.2.1中又被恢復了,以免這樣做。

+0

因此,矢量繪圖是現在固定的?我一直在使用23.1.0 –

+0

現在似乎工作正常 –