As the title says, when you deal with real images which appear in splash screens or on background or in Alert popups, do you convert them to nine-patch or you simply resize them into several images (800x480, 960x540 , 720x1280, etc.)?
I am not converting them to nine-patch but resize to most-used formats and I am wondering if I am making a mistake in so doing.
I'd say that it definitely depends on how you want your image to behave on different screen sizes.
If you want to specify that some areas of the image can be stretched and some others cannot, then 9-patch seems relevant.
On the other hand, if your image should not be transformed/stretched then you'd better give as many image sizes as required to cover a majority of screens.
Related
When implementing a splash image which has such a design that image cannot be skewed or cropped if the device screen is of different resolution or size, how to perfectly implement this? Image must be a real full-screen without black background due to different aspect ration.
Shall we create splash image for every device screen size? This is how we do at the moment and it's pretty much work. So we go to Android developer support screen advise page to know what images sizes we need. you see, there are a lot of them.
Is there a better and quicker solution?
just get the splash screen in 1920*1080 and put in xxhdpi android system will auto ajust it
Stretch occurs when when try to fit an image into an image view of different Aspect-Ratio.
Create 2 or 3 images for major Aspect-Ratio and then use android:scaleType="fitXY" on your image view, for devices that uses different aspect-ratio than you specify it won't differ a lot so you don't get a noticeable stretch.
Most common aspect-ratio are:
2:1 // ultra wide ex. 800*400 screen
16:9 // HD wide ex. 1920*1080 , 1208*720 , 720*450
16:10 // wide
4:3 // old tv square-like
If you can prepare a image resolution 1920*1280 and put in drawable-xxhdpi, it would fit to any screen
Try to create a 9-patch image and use it as a background of the splash activity/view/whatever. Put your fixed size logo (or whatever you want to display) in the non-scalable part of the 9-patch and let the other areas stretch to fill the view. Note that the non-scalable area (e.g. your logo) should have size that will fit the smallest display you want to support.
What is the size of the background images (png files)? How do I determine the size of the image? (I would like to cover the entire relative layout, thus the entire screen)
Do I need to have several png files, all with the same image but with different sizes to be supported on all screens? (3.7 inch, 4.2 inch, tablet size and etc...)
Can anyone help?
I though of having 1 image and then streching it according to the screen size retrievd from the device system, is this the correct method?
you can use fill parent but for accurate info
use http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch
it will help you to provide resources it is the developers site -- it has info on providing resourses you can also see supporting multiple screens for better understanding
Is there a way to have Android select a different image based upon the screen size? According to the docs and my testing, images must be placed in folders like drawable, drawable-mdpi, drawable-hdpi, etc.
These folders however relate to the screen dpi and not the screen size. The layout folders are used to handle different screen sizes but they don't allow you to store images in them. Only xml files.
So if I run my app on two devices with the same dpi but with different screen sizes, the same image gets selected from the same drawable folder. What I really want is for a larger image to be selected for the larger screen and a smaller image for a smaller screen.
Thanks for your help.
Yea, you are right, this is how works Android, by saving different pictures in particular folders (l,m,h and xh -dpi).
Where is your problem?
You want to keep images for all screen resolutions? Its too many of them.
Can you write more specific what you want achieve?
If you have a problem in layouts.xml, just check:
android:scaleType="..."
You can use 9-patch images. A 9-patch image can be stretched without loosing quality. You may refer to the following link for more information http://developer.android.com/guide/developing/tools/draw9patch.html
I'm trying to create a splash screen of sorts for my Android App but am having problems getting the image to fill the screen (too tall, too skinny, etc). Instead of messing around recreating the image a million times to find the correct dimensions I was wondering if there is a "standard image size" that I should use for each screen density if I want it to properly fill the entire screen?
I would make the image stretchable using draw-9-patch. You will probably still need a few different image sizes but this way your images should be able to stretch without getting distorted for screen sizes you aren't expecting.
Yeah the Android docs has all of this relevant information in the: Supporting Multiple Screens section. There is a table in there that should specify all of the different screen sizes that you will need to account for.
I would like to show a splash screen image. I've read Screen compatibility overview about the different directories (ldpi, mdpi, ...) to create under res/ but I've not understood if, other than creating the same image of 240x320, 320x480 and 480x800 I need to do other things to achieve a good result.
Can anyone suggest me which is the best thing to do?
What you describe is what you need to do. You need an image for each screen pixel density group (ldpi, mdpi, hpdi and poss xhdpi)
Other things you can do?
Use a background around the image so the image appears to stretch (e.g. if image is white near the edges, use a white background). It'll look better if there isn't an obvious border around the image and it fades into a background.
The background/borders could be a 9-patch, stretchable image
In theory you could provide a lot more images and select them at runtime based on actual screen size, but it's a very bad idea (you never know what new sizes are coming)
Remember to include portrait and landscape versions - never a good idea to assume one orientation if you can possibly avoid it
Think of an Android screen like a resizable web page - they come in various different sizes and shapes, and your layout needs to stretch and adapt for all.
Like Ollie C said, I also make a 9-patch that I set in background, the only probleme with this methos is that your Splashscreen must have uniform stretchable areas.