different devices with different image and font size - android

I am creating an app for different devices and I added images with different sizes in drawable-small, drawable-medium... to add the same image for different devices but I need to increase the size of the image when the size of the screen increases is this the correct way?
plus I need to increase the font size when the screen size increases how can I do that and if I used the layout-small... folders what font size will be the perfect size for the devices with small screen size (portrait and landscape) and for the medium and large..?where can I find this info as I am trying and trying different font sizes but there must be another way!!
thanks.

This is a very rookie question but here goes:
You set the text and image sized in dp (density pixels) so screen size and resolution is irrelevant.
As for making multiple drawables for each screen size is a good idea but not a necessity since you can choose how much of the screen each picture will take, but on bigger screens make sure the resolution of your images are high enough to look good.

For scaling a particular image to all screen size you can use nine patch image. There will be drawninepatch.bat file in the tools folder of your sdk. Open that , drag and drop the image , and you want to expand the image based on your needs. Now after the nine patch is created put that in the drawable folder. This image will expand accordingto the screen resolution and densities.

Related

how to use vector images for different android screen sizes

how to use vector images which scale up and down according to the screen sizes?
I m using a vector image in my project but it is not scaling in big screens.
what you mean by being scaled ? maybe you are misunderstanding.
if you mean the image size would be changed in various screen sizes such thing wont happen. the image size is what you provide in your imageview (or any otherview using the image).
the only different between vector assets and normal asset is that vector asset are redrawn every time so you wont have a low quality image no matter how big it is and which device it is being shown in. so you wont need to save various size of image for various size of screens.
if you want to change the size of image just change the imageView height and width. you can use dp (density independant) unit.
you dont have to do anything for support vector images for diffrent screens its already scale for the relevant dp, Can you give more details about your problem when you say "it is not scaling in big screens?"
maybe you want the image on tablets will be bigger?

How to properly implement full-screen images perfectly stretching on all screens?

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.

Handling image resource size on Android

I am kind of confused about managing graphic resources in Android.
Tried to read this doc but It only confuses me more. Can anyone give me some example of how should I handle the following case?
Lets assume that I have an image in my layout that will be scaled to fill screen width. What image sizes (in pixels) should I produce and what configuration qualifiers (drawable-{qualifier}) should I apply to those resources to cover all major dpi and screen sizes (both for tablet and handset)?
Thanks.
If you want to have an image, that is supposed to fill the screen it is best to use 9-patch images. This way your image can automatically scale to fit the device. Because even if an image has the correct density, the actual screen size can vary. For example a smartphone and a tablet can both be hdpi, but have completely different screen sizes (and actual pixel count).
So the easiest way to target most devices, when it comes to images that are supposed to fill up the full width of the screen is to have a 9-patch image and create ldpi, mdpi, hdpi and xhdpi versions of it. This way the image will automatically be choosen depending on the density and then stretched to fit the device.
The android sdk also provides a tool that helps with creating 9-patch images http://developer.android.com/tools/help/draw9patch.html

How can I have bigger imageview for larger screen size layout?

I am looking at my android design for medium and large screen. I have designed my layout for mdeium screen (viewing it on the eclipse editor and emulator) and making sure it is good. My design involves textview and images view. I have create the 3 drawable folders for different density sizes so the picture can occupies the rough space on different densities.
Now, I am looking at the large screens (and even xtra large screens) but my textviews and images views looks very small (compared to the size of the screen). Therefore I would like to make use ofd the extra space by enlarging everything.
I know how to do it for text views, basically I would make textsize bigger (ie. instead of 12 sp I can make it 16sp)
But How can I do it for ImageView? The Imageview displays the image according to its size. And the size of the image is really meant for medium screen. How can I make it bigger? Should I provide the same image with a bigger size and a different name?
Please help, btw plz dont point me to the android develoment supporting mutliple screens cause I read it and I couldn't find what I need unless I missed a certain line that answers my question.
Thank you for your help
Decided to edit the question maybe people can understand my question more.
I have an image that is 50 X 50 pix in medium density medium screen size. Let say that this image occupies 5 by 5 millimeters, Now if I want to display the same image on medium desnity XLARGE screen but I want it to be bigger (say occupies 10 by 10 millimters). How do I achieve that? I understand I wil lneed different layout in the XLARGE folder so in this layout what should I do with that image view? Do I create a new PNG file with 100X100 pix and place it in the medium density folder?
you can use layout-xhdpi ,layout-hdpi etc..as per your requirement.
All of your screen xml files can be placed in multiple folders (layout, layout-large, layout-xlarge, etc.) in which you can scale the size of the UI components in DPI based upon the size of the screen. See Android documentation here.

Android Screen Size resources

I am trying to understand screen sizes and densities and what I really need to do in order to make my multiple choice question game work on every Android screen nicely. I want my game to look the same in every screen size and density meaning no changes to the layout and good looking images.
Basically my game displays questions which are png files, and answers to choose from which are also png files. I specify each imageview size and imagebutton in dp, and the locations of these on the screen in dp. For my layout background image I just have it fill parent width and height.
So my question is why can't I just have one drawable folder with hdpi images? Therefore, the images would be scaled appropriately in dp on all screen sizes and located in the same place and look the same on every screen. And the images would look good on hdpi screens and smaller ones? Also, why can't I just have one layout folder with the same explanation?for your answers!
You can create the only one folder but the images in that must be .9.png bcoz these images stretched according to the screen. Another way is create the different size images and place them in the hdpi,mdpi,ldpi folders.
You can create only one folder for both ressources. But for image, if you dont want to get uggly stretched image you should create 3 image size with different dpi for each folder. Your picture will be sharper for hight dpi screen and faster for low dpi screen with a picture near the final size.

Categories

Resources