I'm trying to draw a circle which will have the same diameter of 2.5 inches (or any other value) in every android device, regardless of the screen size. The diameter size must be same in all the devices and below is what I have tried.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:background="@drawable/light"
tools:context=".MainActivity">
<ImageView
android:layout_width="3in"
android:layout_height="3in"
android:src="@drawable/oval_shape"
android:id="@+id/imageView"
android:scaleType="matrix"/>
</RelativeLayout>
oval_shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#666666"/>
<size
android:width="2.5in"
android:height="2.5in"/>
</shape>
The issue with this code is when I try it with 4.5 in screen (real phone), the diameter is 2.5inches as expected but when tested in 4 inch screen the diameter is less than 2.5 inches, it has a slight difference. I tried using millimeters (mm) as well but it didn't work well either.
So how can I achieve the requirement of same size circle in every phone?