Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Responsive design for all android devices

I am using two different methods to achieve responsive design in android devices

Method 1. I used different dimens.xml in different folders like

values-hdpi
values-ldpi
values-mdpi
values-xhdpi  
values-xxhdpi

Method 2. I copied all my layouts to

layout
layout-large
layout-small
layout-xlarge

folders and given different heights, widths and other

When I use the first method I am not getting the correct responsive design and when I use the second method I am getting the correct design but it increasing the application size.

So, please tell me the best process to achieve 100% responsive design other than my two methods

like image 755
Bahu Avatar asked Mar 28 '16 14:03

Bahu


Video Answer


1 Answers

I usually go for the values, values-large, ... folders and put dimens.xml files there, where I specify the sizes for each screen size category. The values is the "fallback", it contains the default value if I don't specify any for a specific size category. In the layouts I use it like this:

android:width="@dimen/width_for_this_view"

Defined in the values/dimens.xml:

<dimen name="width_for_this_view">30dp</dimen>

You can define different sizes for different values (large, normal, small, ..) folder.

like image 71
Gabor Novak Avatar answered Sep 18 '22 14:09

Gabor Novak