【问题标题】:9-patch Android not showing margins9-patch Android 不显示边距
【发布时间】:2014-01-05 20:26:46
【问题描述】:

我正在尝试制作一个 9-Patch 图像以用于 Android 应用程序。

这是来自 9-Patch 工具的截图以及我的图片:

我在布局上添加了这张图片:

<Button android:id="@+id/tiny"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:text="Text"
android:textSize="8sp"
android:background="@drawable/arrow_active" />

(图片位于“drawable”文件夹,图片名称为“arrow_active.9.png”)

这是来自eclipse的截图:

在真实设备上我也看不到图像的箭头。

我试过ImageView和Button,布局是TableRow。

我也尝试使用较小的图像:

在真实设备上,我看到 9Path 工具添加了黑色像素。

【问题讨论】:

  • 看到黑色像素很奇怪,好像它没有检测到它是九个补丁。我不确定这是否是强制性的,但我看到您没有任何垂直可拉伸部分(即左行中没有黑色像素)。也许你可以尝试在中间添加一个黑色像素来看看会发生什么
  • 另外,你可以尝试设置左边线和底线来匹配整个宽度和高度,也只是为了看看会发生什么并尝试获得线索
  • 感谢帮助,问题是我没有定义任何垂直像素。我选择了宽度区域,现在工作正常。

标签: android css eclipse drawable


【解决方案1】:

Try this tool... 它的图形效果很好,并为所有存储桶自动生成图像。您可以从中设置 streatch 区域和内容填充..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-04
    • 1970-01-01
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 2010-12-21
    • 2015-06-13
    相关资源
    最近更新 更多