Xamarin.Android 启动画面大小
Xamarin.Android Splash Screen Size
我有一个启动画面问题,我有一个简单的徽标,我想大致位于屏幕的中央。出于某种原因,我拥有的可绘制对象占据了整个屏幕,并且不会将我的图像整齐地居中。我听说过 9 补丁图像,但我不确定这是否适用于此(我认为这是用于图标?)。无论如何,这就是我的可绘制对象。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/orangey_red"/>
<item android:gravity="center">
<bitmap android:src="@drawable/ic_launcher"
android:gravity="center"/>
</item>
</layer-list>
我还为这个可绘制对象定义了一个主题。这里是 /values/style.xml
<resources>
<style name="MyCustomTheme" >
<item name="android:windowBackground">@drawable/splash_screen_drawable</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
我正在使用 Xamarin.Android(本机),无法解决这个问题。
你提供的代码在我这边效果很好,样式如下:
<style name="MyCustomTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
这是启动画面:
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/orangey_red"/>
<item android:gravity="center">
<bitmap android:src="@drawable/dapao"
android:gravity="center"/>
</item>
</layer-list>
我在github上也提供了我的demo,你可以对比一下你的项目
我解决了这个问题。看来我的徽标尺寸对于屏幕来说太大了,所以将图像调整为较小的分辨率是我的问题的解决方案。
我有一个启动画面问题,我有一个简单的徽标,我想大致位于屏幕的中央。出于某种原因,我拥有的可绘制对象占据了整个屏幕,并且不会将我的图像整齐地居中。我听说过 9 补丁图像,但我不确定这是否适用于此(我认为这是用于图标?)。无论如何,这就是我的可绘制对象。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/orangey_red"/>
<item android:gravity="center">
<bitmap android:src="@drawable/ic_launcher"
android:gravity="center"/>
</item>
</layer-list>
我还为这个可绘制对象定义了一个主题。这里是 /values/style.xml
<resources>
<style name="MyCustomTheme" >
<item name="android:windowBackground">@drawable/splash_screen_drawable</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
</resources>
我正在使用 Xamarin.Android(本机),无法解决这个问题。
你提供的代码在我这边效果很好,样式如下:
<style name="MyCustomTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
这是启动画面:
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/orangey_red"/>
<item android:gravity="center">
<bitmap android:src="@drawable/dapao"
android:gravity="center"/>
</item>
</layer-list>
我在github上也提供了我的demo,你可以对比一下你的项目
我解决了这个问题。看来我的徽标尺寸对于屏幕来说太大了,所以将图像调整为较小的分辨率是我的问题的解决方案。