我面臨同樣的問題,但決定深入調查一下。原因是我一直注意到我的可繪製作品中的一個,而另一個始終是壞的。訣竅在於一個圖像是由另一個圖像製成的,只需對顏色和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