Placing an imageview at the center of the layout regardless of screen size android? : I am new to Android and so this is me experimenting with my layouts. I want to place an imageview at the center of the layout screen and it should be at the center regardless of device size or resolutions. Additionally, the imageview should automatically scale up in size depending on the device sizes. How should I go about it ?

This is what I tried so far.

    <?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:orientation="vertical"
        tools:context="com.inducesmile.androidcameraapi2.AndroidCameraApi">
        <TextureView
            android:id="@+id/texture"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/btn_takepicture"
            android:layout_alignParentTop="true"/>
        <Button
            android:id="@+id/btn_takepicture"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="16dp"
            android:layout_marginTop="16dp"
            android:text="take_picture" />
    
        <ImageView
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:id="@+id/imageView"
            android:layout_alignParentTop="true"
            android:layout_alignEnd="@+id/btn_takepicture"
            android:layout_marginTop="140dp"
            android:src="@drawable/rectangle" />
    </RelativeLayout>