I want to put a text, a button or something like that in a specific place on an image. But as devices have different screen resolution, the text is changing position and don't remain there where I have positioned it.
That is a view on Nexus 4:
That is a view on Pixel 2 XL
How can I solve this problem?
tuner_activity.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/manico"
android:contentDescription="@string/chords" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="81dp"
android:layout_marginStart="81dp"
android:layout_marginTop="100dp"
android:text="D"
android:textColor="@color/black"
android:textSize="35sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/imageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="180dp"
android:layout_marginStart="180dp"
android:layout_marginTop="100dp"
android:text="G"
android:textColor="@color/black"
android:textSize="35sp"
app:layout_constraintStart_toEndOf="@+id/textView"
app:layout_constraintTop_toTopOf="@+id/imageView" />
</android.support.constraint.ConstraintLayout>