Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I create a 9 patch image for splash screens, it comes out way too small for larger devices

I've decided to use a 9 patch image for my splash screens.
The problem is, on larger devices, that the Splash Image is way too small, and I want my splash to take up the majority of the screen.

On smaller devices it is fine.
I don't think I am creating these 9 patch Images the correct way.

Can somebody point me to a some site, or GitHub repository that uses a 9 patch splash screen image that takes up most of the screen size on all devices?

I want to put this in my app and see what I'm doing wrong.

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>
like image 412
stepheaw Avatar asked Dec 25 '22 12:12

stepheaw


1 Answers

This

<item>
    <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
      android:src="@drawable/splash" 
      android:tileMode="disabled"
      android:gravity="center"
    />
</item>

must be changed to

<item>
    <nine-patch xmlns:android="http://schemas.android.com/apk/res/android"
      android:src="@drawable/splash" 
      android:tileMode="disabled"
      android:gravity="center"
    />
</item>

Reference: http://developer.android.com/guide/topics/resources/drawable-resource.html#NinePatch

like image 106
Phantômaxx Avatar answered Dec 27 '22 01:12

Phantômaxx