这是一个 3x3 图像。对不起。

我使用以下 3x3 图像。

因此,当我使用 draw9patch.bat 打开并分别在顶部和左侧添加 2 个像素时,我得到以下图像。

我希望如果我将此图像应用于 TextView ,我的整个 TextView 将有 1 像素宽度的边框。

但是,我只能设法获得“半边距”。缺少右侧和底部的边框。

<?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:gravity="center_horizontal|center_vertical"
    android:orientation="vertical"
    android:background="#ffffff" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:background="@drawable/border" />

</LinearLayout>

我的 9 补丁图像有什么问题吗?

9 补丁图像用于您的测试目的。

最佳答案

尝试在它周围添加 1px 的空白空间。见附图。

关于android - 九块图像在 TextView 周围绘制 1 个像素的边框,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11645284/

10-09 07:13
查看更多