非常简单:如何确保图标背景透明度生效?
我在透明背景上有文字或图像的图标和启动画面。当安装在Android设备上时(多个/每个设备),我得到一个白色正方形图标,而不是按预期显示,并且启动屏幕往往显示黑色背景。
这就是我希望我的图标看起来像什么(适用于浏览器,常见的图片浏览器,Playstore等):
基本上,我得到了这个:
抱歉这个蹩脚的例子。我手绘油漆。我的MainActivity看起来像这样......
[Activity(LaunchMode = LaunchMode.SingleTop, MainLauncher = true, Label = "myapp", Icon = "@drawable/icon", Theme = "@style/splashscreen", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{...
我的styles.xml如下所示:
<style name="splashscreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowIsFloating">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>