是否可以在LayerDrawable中使用多个9补丁图像?
我想在 LayerDrawable 中使用两个九个补丁
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/solid">
<nine-patch android:src="@drawable/button_header_solid" android:dither="true" />
</item>
<item android:id="@+id/transparent">
<nine-patch android:src="@drawable/button_header_transparent" android:dither="true" />
</item>
</layer-list>
,似乎只有第一层被拉伸,而第二层保持原样。
两个图像的大小都与 .png 相同,并且具有相同的可拉伸区域和填充区域。
问题是:我们是否允许使用多个 9 补丁(在一个图层列表中)还是只允许使用一个?
谢谢。
I want to use two nine patches inside LayerDrawable
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/solid">
<nine-patch android:src="@drawable/button_header_solid" android:dither="true" />
</item>
<item android:id="@+id/transparent">
<nine-patch android:src="@drawable/button_header_transparent" android:dither="true" />
</item>
</layer-list>
And it seems that only first layer is stretched while second one stays as is.
Both images are of the same size as .png, and have equal stretchable and padding areas.
The question is: Do we allowed to use several 9-patches (in one layer-list) or only one is allowed?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
刚刚面临同样的问题。
试试这个:
Just now faced with the same problem.
Try this:
以下内容使两个 9 补丁的行为符合您的预期(在 Android 2.2 上测试)。两个 9 块都被扩展以填充整个可绘制区域。
The following makes both 9-patches behave as you would expect (tested on Android 2.2). Both 9-patches are expanded to fill the whole drawable area.