I would like to create an app in android studio using kotlin. In one of my activities there is a background image (blue) and a circle image (red). I want the background to stretch to screen sizes of different devices. (see image below) This means the circle sometimes gets smaller relative to the background.
Is there a way to adjust the circle size automatically and to keep it centered? As you see I tried with
android:background="@drawable/background"
and was also playing around with
android:scaleType="fitXY"
But it didnt work out. Any help is greatly appreciated! Thank you.
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
tools:context=".MainActivity">
<ImageView
android:id="@+id/background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/background"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="100dp"
android:layout_marginTop="200dp"/>
<ImageView
android:id="@+id/circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/circle"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="100dp"
android:layout_marginTop="200dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>


