边框线出现在Android中的drawable中

时间:2014-05-13 06:57:23

标签: android android-layout android-drawable nine-patch

你好我试图从这个工具Android Asset Studio获得九个补丁,它生成了不同密度的抽象和抽象我设置为按钮的背景但它生成的drawables在四个图像周围的边框线当我试图在设备中运行应用程序时也会出现这一面。

为什么会这样,你能告诉我这是如何避免的吗?

<Button
    android:id="@+id/submitButton"
    android:layout_width="match_parent"
    android:contentDescription="@null"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/sign_up_views_vertical_top_margin"
    android:background="@drawable/sign_up_via_email_selector" />

sign_up_via_email_selector.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/sign_up_submit" />

</selector>

enter image description here

提前致谢

2 个答案:

答案 0 :(得分:2)

检查图像是否具有正确的名称。

它应该是 sign_up_submit.9.png ,出现的行实际上是9patch为拉伸定义的区域。

如果图像具有正确的名称,则您使用的在线实用程序应用程序可能会破坏资源。尝试使用android sdk中的9patch生成器(查找 [your_sdk_path] \ tools \ draw9patch.bat ),并尝试自己生成一个并查看问题是否是还在那里。

答案 1 :(得分:2)

请您检查一下如何将9个补丁图像放在可绘制文件夹中,9个补丁图像应该命名为sign_up_submit.9.png