2017-03-23 53 views
4

我試圖用這個指南來實現:與<屏蔽圖標>創建自適應圖標

https://developer.android.com/preview/features/adaptive-icons.html#Creating

爲AndroidØ預覽,但發射顯示我默認的Android圖標,並表示不兩層在我ic_launcher.xml

ic_launcher.xml

<maskable-icon> 
    <background android:drawable="@mipmap/layer0"/> 
    <foreground android:drawable="@mipmap/layer1"/> 
</maskable-icon> 

有沒有人試圖實現這個?還是不可用?

(在我的表現,我把圖標ic_launcher.xml)

UPDATE: 谷歌更新您的網站,並把adaptive-icon代替maskable-icon

回答

3

我找到了答案,當我檢查該文件下方。

\android-sdk-windows\platforms\android-O\data\res\drawable\sym_def_app_icon.xml 

<?xml version="1.0" encoding="utf-8"?> 
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> 
    <background android:drawable="@android:color/white" /> 
    <foreground android:drawable="@mipmap/sym_def_app_icon_maskable" /> 
</adaptive-icon> 

我不知道哪個最終是對的。 但現在(預覽1),自適應圖標標籤似乎正常工作。

+0

爲我工作。請參閱相應的問題: https://issuetracker.google.com/issues/36535386 – sebastian

1

你忘了在清單中定義它?

<application 
     ... 
     android:icon="@mipmap/ic_launcher" 
     ...> 

    ... 

</application> 
+0

沒有......顯然我把清單中的,我沒有在紋理貼圖僅此屏蔽圖標其它圖標.. – HerberthObregon

0

您可能需要添加到您的AndroidManifest.xml文件太:

android:roundIcon="@mipmap/ic_launcher_round" 
+0

這不是必需的。 – M66B