当我为启动画面创建一个 9 补丁图像时,它对于较大的设备来说太小了
When I create a 9 patch image for splash screens, it comes out way too small for larger devices
我决定为启动画面使用 9 补丁图像。
问题是,在较大的设备上,启动图像太小了,我希望我的启动图像占据屏幕的大部分。
在较小的设备上没问题。
我认为我没有以正确的方式创建这 9 个补丁图像。
谁能给我指点一个网站,或者 GitHub 存储库,它使用了 9 个补丁的初始屏幕图像,它占据了所有设备上的大部分屏幕大小?
我想把它放在我的应用程序中,看看我做错了什么。
SplashTheme.xml
<resources>
<style name="SplashTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
splashscreen.xml
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" > //This is so I can have a white background
<solid android:color="#FFFFFF" />
</shape>
</item>
<item>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
</layer-list>
这个
<item>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
必须改为
<item>
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
参考:http://developer.android.com/guide/topics/resources/drawable-resource.html#NinePatch
我决定为启动画面使用 9 补丁图像。
问题是,在较大的设备上,启动图像太小了,我希望我的启动图像占据屏幕的大部分。
在较小的设备上没问题。
我认为我没有以正确的方式创建这 9 个补丁图像。
谁能给我指点一个网站,或者 GitHub 存储库,它使用了 9 个补丁的初始屏幕图像,它占据了所有设备上的大部分屏幕大小?
我想把它放在我的应用程序中,看看我做错了什么。
SplashTheme.xml
<resources>
<style name="SplashTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/splashscreen</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
splashscreen.xml
<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" > //This is so I can have a white background
<solid android:color="#FFFFFF" />
</shape>
</item>
<item>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
</layer-list>
这个
<item>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
必须改为
<item>
<nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/splash"
android:tileMode="disabled"
android:gravity="center"
/>
</item>
参考:http://developer.android.com/guide/topics/resources/drawable-resource.html#NinePatch