0

I am trying to design layout for an activity. Since it has a lot of components, layout changes are very visible in different screen sizes. I know that I can create my files with -large, -small and so on. But the activity layout changes even for minor differences in screen sizes, like 4.7, 5, 5.5, 6, 8 and 10 inch sizes, which are supposed to be in the same category.

Do I have to design my layout for all possible screen sizes? Is there a better way? If not, how do I implement the former?

Edit I am including the screenshots for 5 and 5.2 inches. 5 inch

5.2 inch

Vini.g.fer
  • 11,639
  • 16
  • 61
  • 90
Pranay Kumar
  • 400
  • 1
  • 3
  • 12

2 Answers2

2

How to design my layout for different screen sizes

Google had resolved this issue by releasing a Density independent pixels in the android sdk it basically converts your pixels to the pertaining screen size. For ex: if you want an edit text with 100dp width it will be consistent across the screen. Besides this there is also MAtch parent which covers he entire screen and wrap content which takes how much ever the widget occupies

Aniruddha K.M
  • 7,361
  • 3
  • 43
  • 52
0

For custom density layouts use layout-sw600dp
Eg: 7" tablets: Instead of layout-large, use layout-sw600dp.

For getting good result in all devices
1. Always use LinearLayout instood of RelativeLayout or AbsoluteLayout
2. Design a reduced layout for small screen devices
3. Prepare image resources for all screen densities
4. Declare on AndroidManifest for which sizes you want to support

salih kallai
  • 879
  • 2
  • 13
  • 34