我正在尝试使用9个补丁图像显示此气球,尽管根据我定义的文本,看起来的背景似乎并未拉伸。
我已经按照图1所示设置了内容区域,并且当前输出如图2所示。
欢迎您的帮助。谢谢。
<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" />
答案 0 :(得分:0)
我用9个补丁(将TextView
添加到res > drawable
中)对您的balloon.9.png
进行了复制粘贴。
这是我的布局:
<?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>