I want to know how I can write text on image and auto-adjust text size.
Let's say I have the image below
How can I put text into this image and auto-adjust text size depending on the length of the text ? I don't want to deform the image I just want to change the text size. And of course I don't want the text go out of the square.
Edit 1:
<LinearLayout 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"
android:background="@drawable/background">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/dice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/dice" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/dice"
android:layout_alignTop="@+id/dice"
android:layout_alignRight="@+id/dice"
android:layout_alignBottom="@+id/dice"
android:text="Lorem ipsum dolor sit amet bla bla bla bla Lorem ipsum dolor sit amet bla bla bla bla Lorem ipsum dolor sit amet bla bla bla bla Lorem ipsum dolor sit amet bla bla bla bla"
android:gravity="center"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageView
android:id="@+id/dice2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/dice" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/dice2"
android:layout_alignTop="@+id/dice2"
android:layout_alignRight="@+id/dice2"
android:layout_alignBottom="@+id/dice2"
android:text="Coucou"
android:gravity="center"
/>
</RelativeLayout>
Edit 2 :