I am trying to show this balloon using 9 patch image, though the background imaged doesn't seem to stretch according to the text I defined.
I have set the content area as shown in image 1. And the current output is shown in image 2.
I am welcome for any help. Thanks.
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/balloonView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title this is dummy text, this is dummy text, this is dummy text"
android:textSize="13dp"
android:textColor="@android:color/white"
android:background="@drawable/balloon" />
I did copy-paste of your TextView
with 9-patch (added to res > drawable
as balloon.9.png
) and it works.
Here is my layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/colorPrimary"
android:padding="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/balloon"
android:text="Title this is dummy text, this is dummy text, this is dummy text"
android:textColor="@android:color/white"
android:textSize="13dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/balloon"
android:text="Title this is dummy text, this is dummy text, Title this is dummy text, this is dummy text, Title this is dummy text, this is dummy text, Title this is dummy text, this is dummy text, Title this is dummy text, this is dummy text, Title this is dummy text, this is dummy text, Title this is dummy text, this is dummy text, Title this is dummy text, this is dummy text, this is dummy text"
android:textColor="@android:color/white"
android:textSize="13dp" />
<TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:background="@drawable/balloon"
android:gravity="center"
android:padding="40dp"
android:text="Title this is dummy text, this is dummy text, this is dummy text"
android:textColor="@android:color/white"
android:textSize="13dp" />
</LinearLayout>