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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With