How to make button non transparent?

后端 未结 6 1361
南笙
南笙 2020-12-31 04:10

I wrote custom View which draws a circle. Then I put it on relative layout. Also I put standard button there, so that they overlap. And I see that button is transparent. How

6条回答
  •  情书的邮戳
    2020-12-31 04:56

    The holo transparency is actually built into the PNG files. So the only real way to change it is to edit the PNGs and make them non-transparent. This is actually not easy at all. You need to multiply the alpha channel of the image by 255/102. Which isn't easy!

    But because I am such a genius, I found a way to do it. Basically I copied all the relevant PNGs and XMLs into their own directory structure (the buttons only have -mdpi, -hdpi and -xhdpi versions). Then I ran this:

    for FILE in find . -name *.png; do mogrify -evaluate Multiply 2.5 -channel Alpha $FILE ; done

    Job done! Actually it didn't quite work for the disabled buttons for some reason - I think because the centre is super-transparent, but I don't care so much about those. You'll have to use a higher value than 2.5 for those images if you want them totally non-transparent.

    Anway the result is here.

提交回复
热议问题