What if I need the android:padding="120dip" to be different depending on screen size and I don’t want to create several other xmls?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/right_back"
android:orientation="horizontal"
android:padding="120dip" >
As you want different value for one string resources – based on the different screens, you can create different
valuesfolder the same way we havedrawablefolders:In all folder, create dimens.xml and make sure you will give the same variable name in every file but different value.
For example:
My dimens.xml in values folder is like:
So now, you just need to mention
android:padding="@dimen/padding_val".But this is just for
valuesfolder, create the same dimens.xml file and put the value you want.