Place different TextView on top of ImageView always in the same place

1

Hello! What I need is that the textview are always in the same place as the imageview using match_parent for layout_width and layout_height in the.

This is how I want it to be on any screen (The test would be on a 5'5 screen):

But if I put for example in 4'7, this happens:

I've tried RelativeLayout , ConstraintLayout , FrameLayout and I still do not get what I say.

layout :

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.github.siyamed.shapeimageview.StarImageView
        android:id="@+id/image_carta"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal"
        app:siStrokeCap="round"
        app:siStrokeJoin="round"
        app:srcCompat="@drawable/ic_launcher" />

    <ImageView
        android:id="@+id/carta"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:srcCompat="@drawable/cartabase" />

    <TextView
        android:id="@+id/tv1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_marginStart="76dp"
        android:layout_marginTop="150dp"
        android:text="NIVEL 1"
        android:textAlignment="viewStart"
        android:textColor="@color/black"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/tv2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_marginStart="76dp"
        android:layout_marginTop="182dp"
        android:text="NIVEL 2"
        android:textColor="@color/black"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/tv3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_marginStart="76dp"
        android:layout_marginTop="217dp"
        android:text="NIVEL 3"
        android:textColor="@color/black"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/tv4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_marginStart="76dp"
        android:layout_marginTop="250dp"
        android:text="NIVEL 4"
        android:textColor="@color/black"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/tv5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_marginStart="76dp"
        android:layout_marginTop="287dp"
        android:text="NIVEL 5"
        android:textColor="@color/black"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/tv6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:layout_marginStart="76dp"
        android:layout_marginTop="320dp"
        android:text="NIVEL 6"
        android:textColor="@color/black"
        android:textSize="18sp" />

</FrameLayout>

What would be the right way? Thank you!

    
asked by UserNameYo 31.03.2018 в 00:35
source

0 answers