Example of setting translucency and transparency of components in Android

This article introduces how Android sets the translucent and transparent effects of components, and shares them for your reference. Let's see the detailed introduction below:

1. The background of the button or imagebutton is set to transparent or translucent

translucent

transparent

Color and opacity (alpha) values are expressed in hexadecimal notation. The value range for any color is 0 to 255 (00 to FF).

For alpha, 00 means fully transparent and FF means fully opaque. The expression order is "aabbggrr",

Where AA = alpha (00 to FF); BB = blue (00 to FF); GG = green (00 to FF); RR = red (00 to FF).

For example, if you want to apply a blue color with an opacity of 50% to a stack layer, you should specify the following value: 7fff0000

2. Use the transparent effect resources provided by the Android system

Examples of translucent effects are as follows:

First define the translucent color in color.xml, for example:

Then, for example, in the setting for full screen dialog, add the above translucent effect to its background

Complete example --- activity setting transparent / translucent

In RES / values / styles.xml:

In RES / values / color.xml:

be careful:

//The #5000000 first two digits of color.xml are transparent. The effect parameters range from 00 -- 99 (transparent -- not very transparent),

//The last 6 bits are the color settings

Settings in manifest.xml:

java code

summary

The above is the whole content of this article. I hope the content of this article can help you learn or use node.js. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>