I'm developing an app that must work for multiple device screens, so, I separated the drawable and layout folders properly: large-land, large-port, sw720dp and so on.
For devices like Nexus, from Google, I'm having a problem with its menu, that is in OS, not physical, like in others devices.
So, layouts that works well in devices like SIII does not work on Nexus, it seems like shrunken, because I lost a litte of its height.
Discussing with friends, we thought in set its layout programatically, but in a screen with various elements, it's bad to keep. Is there a way to organize this layout and drawable using the android's structure, like I did for others resolutions and sizes?
Thanks in advance.
for the nexus 7 from Asus it will use the drawables in folder drawable-xhdpi so put the drawables there ... and for icons use 48x48 size so they will look the same size as an actionbar icon ...
Related
I am designing an app with a .jpeg background and with text views on particular places on the screen. I designed this for my nexus 6 and used dp for the widths and heights of text views and margin-left and margin-top. What my understanding of dp is that it changes with every device according to screen size and density. So it should work on different phones according to the value of dp for them.
But this is not the case. When I run that app on a different phone (nexus 5) the layout is all messed up. I tried using the different resources and qualifiers for different screens (large, small, normal). But the problem still prevails. The app considers both nexus 6 and nexus 5 as large screens. How do i fix this?
this is not the best solution i guess.
i guess your layout is just on the layout folder. i don't know if the first device you tested the layout is large or small but what you should do is create another folder named layout-sw600dp. this folder is used by tablets. the folder layout is used my phones and smaller devices. you could also create the layout-land and layout-sw600dp-land folders for the landscape orientation.
dp do change depending on the device but if your layout gets messed up then i guess the layout called by that device doesn't fit its resolution. i guess dp becomes smaller if the device is bigger and vice versa.
Its very clear for me what sizes should I use for the different versions of ic_launcher.png inside drawable-hdpi, drawable-ldpi, drawable-mdpi, etc.
What I don't understand is what sizes should I use for a picture (a png) that is simply used in one Activity as an ImageView.
I have this image in high resolution
In a normal pocket device this image should be like 90% width
In a tablet or larger devices, maybe 90% is too big
So, the question is:
Should I create several versions of this an_image-file.png for each folder in drawable? or just use a single version of it and adjust its width via XML? I'm asking because I'm worried about using the best practice in this subject.
There is no clear answer. Only way you can solve this is by trial and error. Sizes are defined for icons only for other image views you will have to try it on 5" smartphone 7" nexus 2 tab and 10" tablet.
At least for these three resolution you will have to create images, for other devices XML layouts will automatically adjust.
i have a question about the app widget in android. I'm a litte bit confused, cause i define in the info xml (res -> xml) the values for width (250) and height (110) (http://developer.android.com/guide/practices/ui_guidelines/widget_design.html). Now i expected my Widget take the in the width 4 cells and in the height 2 cells.
I tested it with a Nexus S (HDPI), all works fine, i tested it with a Nexus 4 (XHDPI), all works fine, i tested it with an Samsung Galaxy Tab 10.1/Emulator tablets (MDPI), it doesn't work, Nexus7 (Emulator) (TVDPI) also it didn't work.
OK, I looked in the Menu and i see the system takes 3 and not 4 cells for the width.
Now my Question is there a way to define specific xml files for the tablets (please notice that i would support device with android 2.3.3) or am I missing something?
Have you tried putting your layout for the widgets into different folders, so that it will be rendered out differently on different screen sizes? For example, when supporting tablets you would have a layout-xlarge folder which contains the layout for your Widget on extra large screens. See here for more information about Tablet layouts.
I have to make an app which runs on 7" tablets with a resolution of 800x480 and also 1024x600.
The most importan tablet of both is the one with 1024x600 so I placed my layout files in a layoutfolder with the name "layout-sw600dp" and it looks good.
The problem now, is that the tablet with 800x480 resolution is also taking the "layout-sw600dp" folder and my layout isn't looking good. So I have to make some changes, but without destroying the layout for the bigger tablet.
Any idea what I can do?
thanks in advance
Frank
ok found a solution. The problem is, that both tablets are in the same android layout group. So I had to modify my layout in this way to fit for both. I had to use more dp settings and scaletype="fitxy" for images, instead of using "wrap_content".
Im trying to set up my app with several layouts so that it will change depending on screen resolution. So i have a ldpi,mdpi, hdpi and a xhdpi. Everything seems to work in the sense that it changes, but to my question.
Is there a way to manually set which resolution to use which layout? for example now when i run it on my Galaxy nexus, it uses the hdpi layout and that just looks terrible, i want it to use xhdpi
regards,
Fredkr
Why don't you set up your hdpi layout to look the way you would like it to rather than trying to force another layout? Your app will automatically select the layout it should use based on the screen size and pixel density of your phone.