0

I have scrolled through loads of documents and questions trying to figure out the right way of giving proper UI experience. I have a app with complex designs . I need to know how to scale my design to look fine in all devices. I got solutions mentioning that a normal layout folder with all layout , and i have traced all textview sizes and image view sizes to values, values-sw 480dp, values-sw 720 dp . Is this the proper dimens? My problem is that though the textsizes and image sizes scale up , still UI doesnt seem right. I mean the margin and all. What is the right solution out? any help?

D Agrawal
  • 471
  • 4
  • 15
  • also do that for dimensions too in dimens.xml – Vivek Mishra Apr 04 '16 at 05:53
  • you mean the layout margin and padding and all? – D Agrawal Apr 04 '16 at 06:04
  • yes that's what I mean – Vivek Mishra Apr 04 '16 at 06:05
  • Can you tell me if values, values-480dp and 720dp are done enough to cover all screen sizes? Also instead of mentioning the padding/ margin in dimen folder , could i instead make layout- 480 and 720 folder and paste the whole layout from normal size design and do the minor changes(like done in layout-land) ? – D Agrawal Apr 04 '16 at 06:45
  • Make all sizes proportional to screen dimensions so it will look exactly the same in all devices. – Nanoc Apr 04 '16 at 06:46
  • yes you can do that also if you don't want to define dimens.xml – Vivek Mishra Apr 04 '16 at 06:47
  • @Nanoc : How exactly to do that? – D Agrawal Apr 04 '16 at 06:48
  • @DAgrawal using DisplayMetrics to get the screen size, then always use a fraction of that number for all your view sizes. use (screenWidth*0.05) for margin for example. – Nanoc Apr 04 '16 at 07:06
  • @Nanoc This has to be done programattically, which doesnt seem a easier option right now, as it then has to be done for all margins and so, which is going to be lengthy. Instead changes i xml would be better. – D Agrawal Apr 04 '16 at 07:31
  • Maybe you should never have started with xml – Nanoc Apr 04 '16 at 07:35

2 Answers2

0

@D try out to make different folder for different screen sizes like layout-hdpi

you can find the best practice for layout handling hear and see the Google documentation hear

Good luck..

Community
  • 1
  • 1
CrazyMind
  • 1,006
  • 1
  • 20
  • 22
0

Its better to use Drawable qualifiers also

drawable

drawable-sw320dp

drawable-sw480dp

drawable-sw600dp

drawable-sw720dp

Raghavendra B
  • 441
  • 3
  • 10