Phonegap - Android Splash Screen - Center Logo

Can someone advise me how to set up a screen saver to work with cross-resolution? I tried to resize the png file to different sizes and put the image in the ldpi, mdpi, hdpi folders, but the image still looks stretched / compressed depending on the device.

Is there a way to place the center of the logo on the screen with a white background, am I glad to use one size of the logo even as long as it sits in the middle and looks normal?

Does anyone have any tips? cheers paul

+4
source share
3 answers

Have you heard / considered using the 9 patch version of the logo? In the ninth patch image, you can identify areas of the image that can be stretched. If you create your logo png file with a white background, and then set the white area as extensible, it will fill your container beautifully, but part of the image logo will not be distorted at all.

+1
source

In your android-sdk directory, under the tools subdirectory, run the draw9patch tool

./draw9patch 

Drag the image. Use the left image to draw pixels on the top and left sides. Use the correct view to check how your image will stretch across devices.

0
source

OK, the answer has EVERYTHING to do with the stretchable areas of your 9patch image. I found the answer, citing a github question. The user sent me to another discussion, where someone hacked him.

The main problem is that most 9patch tutorials explain how to stretch buttons, but there is no detailed information on how to center the image.

Look for a green / blue / red image for just over half of the discussion path.

http://community.phonegap.com/nitobi/topics/stretched_9_patch_splash_screens_android

The key for me was to look at the edges. It’s very difficult for me to see (at least for me), but you can hardly see the black marks along the edge that define the stretched areas. the upper part has 2 small areas (on green), on the left - 2 small (on green), the bottom - one long (on blue), the right - one long (on blue).

Therefore, I find this one image (as hard as seeing the lines) to be a better instruction on how 9patch works than all the tutorials I watched.

0
source

Source: https://habr.com/ru/post/1381680/


All Articles