为什么 Eclipse/device 中的 .9.png 与 draw9patch.exe 中的不一样?
我在draw9patch.exe中创建combobox_normal_m.9.png。在draw9patch.exe 中看起来非常好,但在Eclipse/device 中则不太清楚。为什么边缘模糊?
来自布局:
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_cbutton_m" />
来自选择器:
<item
android:drawable="@drawable/combobox_normal_m"
android:state_selected="false"
android:state_pressed="false"/>
I create combobox_normal_m.9.png in draw9patch.exe. It looks very good in draw9patch.exe, but in Eclipse/device it's not so clear. Why edges are blurred?
from layout:
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_cbutton_m" />
from selector:
<item
android:drawable="@drawable/combobox_normal_m"
android:state_selected="false"
android:state_pressed="false"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经颠倒了顶部和底部 9 个补丁数据。顶部 1 个像素定义了可以拉伸的区域。底部 1 个像素定义了可以被内容覆盖的区域。我猜,除非您打算在文本的右边缘和垂直分隔符之间有一个缓冲区。我可能会误解你想要做什么。
您还会注意到,如果您想要在不同的像素密度下查看不可扩展的功能,您仍然需要为不同的密度创建 9 补丁的版本。在 Eclipse 中,您还会看到屏幕分辨率的放大(通常)版本,因此它可能不能代表设备。
You've inverted the top and bottom 9 patch data. The top 1 pixel defines the area that can be stretched. The bottom 1 pixel defines the area that can be covered with content. Unless, I guess, you intended there to be a buffer between the right edge of the text and the vertical separator. I could be misunderstanding what you are trying to do.
You will also notice that you still have to create versions of the 9 patch for different densities if there are non-scalable features that you want to look right at the different pixel densities. In eclipse you are also seeing a enlarged (typically) version of the screen resolution so it may not be representative of the device.