I have read Android Supporting Multiple Screens but may was something i didn't get.
I created a background image for each drawable folder: 240x320 in drawable-ldpi folder, 320x480 in drawable-mdpi, 480x800 in drawable-hdpi, 640x960 in drawable-xhdpi and 1200x1920 in drawable-xxhpdi.
There are 3 images attached to show you...
The app displays well on the below screens (using emulator):
This isn't a problem with your background image, it is a problem with your layout. For tablets and large screens, or really small screens it is often best to have dedicated layouts which make better use of the space. For example, it rarely is right to just spread out the same content you display on a phone screen so that it fills a 7" tablet. Rather, you would find some portion of the view which should grow and give that a proportional amount of more space (an image for example) or you combine layouts so there is less navigation needed (which is what Fragments help with).
Similarly, for really small screens you can't just shrink the views to fit on the screen you have, you will need to redo the layout so the touch targets are touchable and the text is readable - and this, too, often means re-thinking the navigation (maybe split a single view with a lot of information into two, or adding a ScrollView).
posted 6 years ago
Thank you for your reply!
It's strange that 480x800 mdpi doesn't display well while 480x800 hdpi does.
I am new on Android but i have read a lot about screen optimization...BUT i don't understand about how configure the layout.
Please if you could give me an example or something to understand...
On my res/layout folder there are only activity_main.xml and fragment_main.xml files. What do i have to do?
Thanks in advance
So i have to create inside "res" new folders like "layout-hdpi" etc?
And then what...? I mean i'll create a new XML file,right?
It will be the same fragment_main.XML (with the same name) that will contain what exactly contains the main file and just change the text or whatever may matters??
P.S: I've already create an XML file (only in drawable-hdpi) for the button so when it's "clicked" to appear another image... I didn't create for other folders too cause
i've create the image(button) in different resolution and in the apropriate folder...
The point is that although i have made the 2 images in different resolutions and in the relative folder, the button displays as before...
If you look closely at this tiny ad, you will see five bicycles and a naked woman:
Devious Experiments for a Truly Passive Greenhouse!