How to design proper layout or provide different margin,width and height for two different device i.e 3.2'' HVGA Slider (ADP1) (320X480;mdpi) and Nexus One (3.7'',480X800;hdpi) using values folder, because both devices access same value folder but look is not same.
Asked
Active
Viewed 150 times
1
-
have a look at this question may be it helps you http://stackoverflow.com/questions/21280277/different-values-folders-in-android – Moubeen Farooq Khan Jan 14 '15 at 06:14
-
I have already checked it but not working,because both devices access same value folder i.e.values-sw320dp – Shailesh Jan 15 '15 at 06:55
1 Answers
0
According to doc both devices will really access the same folder. I had similar issue some time ago and I used this code:
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
and after you can make conditions like
if(width>=320 && width<480){
yourView.setTextSize(myTextSize); //or use LayoutParams to define more options
or use switch/case
operator instead
This is how I solved it, but if you have many many view elements, could be not useful.

Yurets
- 3,999
- 17
- 54
- 74