所以我试图用图层列表来覆盖一个透明的九层图。如下所示:
目标http://f.cl.ly/items/2b1x3c3o0w3t1z0b2o2s/Screen%20Shot%202012-06-20%20at%2010.34.18%20AM.png
但我所得到的只是这个(注意,地图图像是由九层顶的边缘裁剪的,尽管它应该是透明的):
问题http://f.cl.ly/items/380j3E2w452Y2D2d1K0a/Screen%20Shot%202012-06-20%20at%2010.29.45%20AM.png
下面是我的图层列表代码:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<nine-patch android:src="@drawable/myninepatch" />
</item>
<item android:drawable="@drawable/detail_map"/>
</layer-list>下面是我的布局ImageView:
<ImageView
android:layout_width="298dp"
android:layout_height="106dp"
android:layout_gravity="center"
android:layout_marginBottom="11dp"
android:src="@drawable/detail_map_overlay" />编辑:,这是九页.png:
九片http://f.cl.ly/items/0X3N0d331Q15380D093n/myninepatch.9.png
有什么办法可以做到吗?不一定要使用九片,但我想使它可伸缩,这取决于图像的大小。或者,如果你知道如何做内在的发光,那也会很棒。
发布于 2012-06-20 09:55:12
重述意见,使之更清楚,以供进一步阅读
您的9修补程序无效:
使用您的示例,它将执行类似的操作(基于您的但不包含无用的部分):

然后将其设置为ImageView的背景:
<ImageView
android:layout_width="298dp"
android:layout_height="106dp"
android:layout_gravity="center"
android:layout_marginBottom="11dp"
android:src="@drawable/detail_map"
android:background="@drawable/myninepatch">
</ImageView>就像这样,你可以去掉图层列表
https://stackoverflow.com/questions/11115799
复制相似问题