Today, there is a situation, that is, at different resolutions below the need to set different distances, when the first reflection is to redefine a layout. However, it is obviously inappropriate to copy so much code just to change a value. It was then thought that it would be better to create different dimen at different resolutions. Of course, if you cut the picture well, it is not allowed to be so troublesome at all. Because of the different resolutions below, if you use DP, it will automatically convert to PX
Change as follows
# Modified: res/layout-port/simple_pad_vfive.xml# new file: res/values-hdpi/funui_dimens.xml# new file: res/values-xhdpi/funui_dimens.xml# new file: res/values-xxhdpi/funui_dimens.xml
Specific as follows
Create a different resolution directory
mkdir res/values-hdpi/;cd res/values-hdpi/;vim funui_dimens.xml
Funui_dimens.xml content is as follows
1<Resources>2<dimenname= "Equal_button_width">87.5dp</dimen>3<dimenname= "Equal_button_margin_right">-0.5dp</dimen>4</Resources>
The reference places are as follows
<Com.android.calculator2.ColorButton161 android:id= "@+id/equal" 162 android:layout_marginright= "@dimen/equal_button_margin_right"163 Android:layout_width= "@dimen/equal_button_width"164 android:layout_height = "158DP"165 android:layout_weight= "1"166 Myattr:textnumber = "@string/equal" />
Values-dimen Resource Reference