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.
Related
I have a background image in an activity, its size was set to 1280x920, as adviced in Background image crashes android. This works perfectly.
I also have a full screen activity (sticky immersive), with the same configuration, the image is "stretched" out vertically. What should be the size of the image so that there is no scaling or stretching at all? (While the image occupies the full screen, off course)
It depends on screen. Android supports multiple screens. That's way in project we have x-hdpi, hdpi, xx-hdpi folder. As source:
https://developer.android.com/guide/practices/screens_support.html
https://developer.android.com/training/multiscreen/screensizes.html
There is no one size. Every Android device has different screen sizes. What you need to do instead is provide multiple sizes and accept some stretching or shrinking on odd sized devices. See https://developer.android.com/guide/practices/screens_support.html for more advice.
i want a default pixel size of image in this size should be adaptable for all type of screen size.Anyone can help me please, How to fix image in all type of mobile screen. it cant be stretched out.
thanks in advance.
There is no default pixel size.
You will either have to design images for each bucket you wish to support, or try and create a 9-patch for your images.
The Supporting Multiple Screens document has everything you need to having your UI scale nicely across devices.
Sorry, You cannot have a Default size...
If you are developing a Mobile app, then you should detect the User's screen size and use an appropriate dimension of the picture there....
Have at least three different variations of the same picture for different screen sizes..
Android Has an inbuilt way of doing this Have a look at this : Supporting Different Screen Sizes
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.
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