我是 android 開發的新手,剛剛創建了我的第一個應用程式。我選擇了我的應用程式圖示,但不知道為什么我保存的影像的背景顯示為綠色,而原始影像沒有。有什么辦法可以去除綠色背景。
上圖是在android studio中選中后的圖片。
如何去除綠色背景?
提前致謝
uj5u.com熱心網友回復:
如果您更換了ic_launcher_foreground.xml來更改圖示,您還需要洗掉ic_launcher.xml和/或ic_launcher_round.xml下面的第三行。
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
無論如何,您看到的是ic_launcher_background.xmlin /res/drawable/。洗掉它,看看是什么損壞了,并通過洗掉對已洗掉 xml 的呼叫來修復它。
uj5u.com熱心網友回復:
代碼結構
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/> // this is background color
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
values/ic_launcher_background.xml在您的專案目錄中找到的顏色資源
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#00FF00</color> // change color using(#) like : #000000(black)
</resources>
我提到了黑色代碼,您嘗試根據您的圖示更改顏色。
或使用像這樣的透明顏色
<color name="ic_launcher_background">#0000ffff</color> // transparent background color
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/317166.html
上一篇:懸停時隱藏影像-SCSS
