9补丁可绘制的表现不好,奇怪的文物 - 这里有什么问题? [英] 9-patch drawable behaving badly, weird artefacts - what is wrong here?

查看:125
本文介绍了9补丁可绘制的表现不好,奇怪的文物 - 这里有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试着出的9片图像。我开始了一个PNG文件在那里我有一个带有圆角的半透明方:

so Im trying out the 9-patch images. I started out with a PNG-file where I have a semi-transparent square with rounded corners:

然后,我创建了9个补丁,像这样(注意,顶部和左侧的小圆点):

Then, I created the 9-patch, like this (note the little dot on top and to the left):

我认为这是足以处理这个问题,但是当加入这种9补丁Eclipse的,我会有奇怪的结果。

I thought that was enough to handle this, but when adding this 9-patch to Eclipse, I get weird results.

结果NBR 1

根据这个XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout6"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/taxibg3"
    android:orientation="vertical" >

    <ImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:background="@drawable/login_square" />
</LinearLayout>

我得到这样的结果:

I get this result:

结果NBR 2

根据这个XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout6"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/taxibg3"
    android:orientation="vertical" >

    <ImageView
        android:layout_width="300dp"
        android:layout_height="158dp"
        android:background="@drawable/login_square" />

</LinearLayout>

我得到这样的结果:

I get this result:

我也试图使顶部的9贴片线,并留下较长,但也给了奇怪的文物。

I have also tried to make the "9-patch-lines" on the top and left longer, but that also gives weird artefacts.

任何想法?

- 编辑 -

我也试过这个9补丁(屏幕截图,从9patch工具):

I also tried with this 9-patch (screen-shot from 9patch-tool):

这使得这个坏的结果(注意黑线):

which gives this bad result (note the black lines):

----编辑2 ----

Leonidos告诉我,9补丁太大,他们无法在尺寸减小。因此,我试过了,用同样糟糕的结果。

Leonidos told me that the 9-patch was too big, and that they cannot decrease in size. So I tried that out, with equally bad results.

这是9补丁(下载的文件这里

This is the 9-patch (download the file here)

这是它的外观(注意黑线):

and this is how it looks (notice the black lines):

---编辑3 ---

--- EDIT 3 ---

我看了看在pathtoo秀坏补丁,这是什么节目:

I took a look at "show bad patches" in the pathtoo, and this is what is shows:

但它没有真正的问题。如果我改变它,所以它看起来是这样的:

But it doesnt really matter. If I change it so it looks like this:

我仍然得到黑色条纹!

哦,为什么,为什么!? =)

Oh why oh why!? =)

推荐答案

请它越小越好。 9补丁不能缩水,他们可以舒展。填写右边和底部边框与黑色的颜色。编辑9补丁的边界与draw9patch工具,以prevent错误。你9补丁应该类似于这个

Make it small as possible. 9-patch cant shrink they can stretch. Fill right and bottom border with black color. Edit 9-patch borders with draw9patch tool to prevent errors. Your 9-patch should look similar to this one.

这篇关于9补丁可绘制的表现不好,奇怪的文物 - 这里有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆