我面临同样的问题,但决定深入调查一下。原因是我一直注意到我的可绘制作品中的一个,而另一个始终是坏的。诀窍在于一个图像是由另一个图像制成的,只需对颜色和alpha进行最小改变即可。除了参考PNG之外,Drawables的XML是相同的。所以我带着pnginfo去看看那里有什么。
diagstripe_dark.png:
Image Width: 18 Image Length: 30
Bitdepth (Bits/Sample): 8
Channels (Samples/Pixel): 3
Pixel depth (Pixel Depth): 24
Colour Type (Photometric Interpretation): RGB
Image filter: Single row per byte filter
Interlacing: Adam7 interlacing
Compression Scheme: Deflate method 8, 32k window
Resolution: 2835, 2835 (pixels per meter)
FillOrder: msb-to-lsb
Byte Order: Network (Big Endian)
Number of text strings: 0 of 0
diagstripe_yellow.png:
Image Width: 18 Image Length: 30
Bitdepth (Bits/Sample): 8
Channels (Samples/Pixel): 4
Pixel depth (Pixel Depth): 32
Colour Type (Photometric Interpretation): RGB with alpha channel
Image filter: Single row per byte filter
Interlacing: No interlacing
Compression Scheme: Deflate method 8, 32k window
Resolution: 2835, 2835 (pixels per meter)
FillOrder: msb-to-lsb
Byte Order: Network (Big Endian)
Number of text strings: 0 of 0
的diagstripe_yellow.png作品,而diagstripe_dark.png没有,如果我更换对它的引用参考diagstripe_yellow.png,那么它的工作原理(至少在2.2.1我到了这里)所以主要区别是:
Channels (Samples/Pixel):
Pixel depth (Pixel Depth):
Colour Type (Photometric Interpretation):
Interlacing:
第一次尝试是禁用交错,没有运气,即使头看起来相同:
diagstripe_dark-2.png:
Image Width: 18 Image Length: 30
Bitdepth (Bits/Sample): 8
Channels (Samples/Pixel): 4
Pixel depth (Pixel Depth): 32
Colour Type (Photometric Interpretation): RGB with alpha channel
Image filter: Single row per byte filter
Interlacing: No interlacing
Compression Scheme: Deflate method 8, 32k window
Resolution: 0, 0 (unit unknown)
FillOrder: msb-to-lsb
Byte Order: Network (Big Endian)
Number of text strings: 0 of 0
如果有人打扰到这里挖更深的文件:http://webnetmobile.com/files/或使用base64工具解码来自以下引号的文件:
diagstripe_yellow.png:
iVBORw0KGgoAAAANSUhEUgAAABIAAAAeCAYAAAAhDE4sAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAL
EwAACxMBAJqcGAAAAAd0SU1FB9wCEg8JKbHU3pgAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQg
d2l0aCBHSU1QZC5lBwAAAE5JREFUSMdj7OnpqWdgYGCQft3S8FS0poFcNhM1DHkqWtPAuLxc4D+l
hjAwMDAwWwa2MIx6bdRro14b9dqo10a9Nuo1Gnstj4GBQYgSAwG9j8m8FwE2EgAAAABJRU5ErkJg
gg==
diagstripe_dark.png:
iVBORw0KGgoAAAANSUhEUgAAABIAAAAeCAIAAAHZaentAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAL
EwAACxMBAJqcGAAAAAd0SU1FB9wCDww0GV3Ql5EAAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQg
d2l0aCBHSU1QZC5lBwAAAGVJREFUOMvtkjsSgCAMRFfvfwOiV30WMCBqKFJIQ8XO/tgiAo6UAOUH
2ABJp5mqWri98B3ZXBmoogx0F4GX3w3LrQnZHju61Cfb6j15RqebG/23On/tHMiRkwheyxq5Rs4Z
aRZIXsBYcInPMeOmAAAAAElFTkSuQmCC
stripes.xml:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:antialias="false"
android:filter="false"
android:src="@drawable/diagstripe_yellow"
android:tileMode="repeat" />
讲,如果你有任何进一步的说明。
它适合我用您提供的代码,是在另一个布局的布局或什么? – SteD 2010-11-02 13:06:02
https://maxalley.wordpress.com/2012/09/27/android-repeating-background-image/ – boctulus 2015-04-02 16:56:34