I try to make my application for different resolution and screen size. For layouts I use weights and it works perfectly but have problem with texts and icons (Vector Assets in androidstudio). Actually I use constant value for texts(e.g 20sp) and icons(e.g 20dp) but when application is open in another mobile icons are too small or too big. Is it possible to scale it by screen size in xml file?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hgyghyfghyu.apkana40.TrainerMenu"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp">
//
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="#000000"
android:layout_marginBottom="10dp"
android:id="@+id/colorsdialogbtn">
</LinearLayout>
//
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
//
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:id="@+id/trainermenugroupsbtn">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/trainermenugroupsicon"
android:tint="#FFFFFF"
android:layout_centerInParent="true"
android:src="@drawable/trainermenugroupsicon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/trainermenugroupsicon"
android:textSize="25dp"
android:textStyle="bold"
android:text=""
android:textColor="#FFFFFF"/>
</RelativeLayout>
</LinearLayout>
//
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:id="@+id/trainermenutrainersbtn">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/trainermenutrainersicon"
android:tint="#FFFFFF"
android:layout_centerInParent="true"
android:src="@drawable/trainermenutrainersicon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/trainermenutrainersicon"
android:textSize="25dp"
android:textStyle="bold"
android:text=""
android:textColor="#FFFFFF"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
//
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
//
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#000000"
android:id="@+id/trainermenuadbtn"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp">
<ImageView
android:id="@+id/trainermenuadicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#FFFFFF"
android:src="@drawable/trainermenuadicon"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/trainermenuadicon"
android:layout_centerHorizontal="true"
android:textSize="15dp"
android:text=""
android:textStyle="bold"
android:textColor="#FFFFFF"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
//info
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:id="@+id/trainermenuinfobtn"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#FFFFFF"
android:src="@drawable/trainermenuinfoicon"
android:layout_centerInParent="true"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:id="@+id/trainermenusettingsbtn"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#FFFFFF"
android:layout_centerInParent="true"
android:src="@drawable/trainermenusettingicon"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>