Android transparency percentage corresponds to hexadecimal

Source: Internet
Author: User

Android transparency percentage corresponding to the hexadecimal first put the results here, convenient for everyone to query, but also convenient for themselves, the UI too like to use a percentage of the =.=!
Percent of transparency corresponds to 16: (Note: The percentage is calculated to have decimals, follow the general rounding process, see below for details) Percentage: 0% hex:00 percentage: 1% hex:30 percent: 2% hex:50 percentage: 3% HEX    : 8,000:4% hex:a0 percent: 5% hex:d0 percent: 6% hex:f0 percentage: 7% hex:12 Percentage: 8% hex:14 percentage: 9% hex:17 Percentage: 10% hex:1a percentage: 11% hex:1c percent: 12% hex:1f percentage: 13% hex:21 Percentage: 14% hex:24 percentage: 15% hex:26 percent Ratio: 16% hex:29 percentage: 17% hex:2b percent: 18% hex:2e percentage: 19% hex:30 percentage: 20% hex:33 percent: 21% hex:36 percent: 22% hex:38 percentage: 23% hex:3b percent: 24% hex:3d percentage: 25% hex:40 Percentage: 26% hex:42 Percentage: 27% hex:45 Percentage: 28  % hex:47 percentage: 29% hex:4a percent: 30% hex:4d percentage: 31% hex:4f percentage: 32% hex:52 percent: 33% hex:54 percent: 34% hex:57 percentage: 35% hex:59 percent: 36% hex:5c percentage: 37% hex:5e Percentage: 38% hex:61 Percentage: 39% hex:63 percentage: 40% H ex:66 percentage: 41% hex:69 percent: 42% hex:6b percentage: 43% hex:6e Percentage: 44% hex:70 Percentage: 45% hex:73 percentage: 46% HEX : 7,500 ratio: 47% hex:78    Percentage: 48% hex:7a percentage: 49% hex:7d percent: 50% hex:80 percentage: 51% hex:82 Percentage: 52% hex:85 percentage: 53% hex:87    Percentage: 54% hex:8a percentage: 55% hex:8c percent: 56% hex:8f percentage: 57% hex:91 Percentage: 58% hex:94 percentage: 59% hex:96 Percentage: 60% hex:99 percentage: 61% hex:9c percent: 62% hex:9e percentage: 63% hex:a1 Percentage: 64% hex:a3 percentage: 65% hex:a6 percent Ratio: 66% hex:a8 percentage: 67% hex:ab percent: 68% hex:ad percentage: 69% hex:b0 percentage: 70% hex:b3 percent: 71% hex:b5 percent: 72% hex:b8 percentage: 73% hex:ba percent: 74% hex:bd percentage: 75% hex:bf Percentage: 76% hex:c2 Percentage: 77% hex:c4 Percentage: 78  % hex:c7 percentage: 79% hex:c9 percent: 80% hex:cc percentage: 81% hex:cf percentage: 82% hex:d1 percent: 83% hex:d4 percent: 84% Hex:d6 percentage: 85% hex:d9 percent: 86% hex:db percentage: 87% hex:de Percentage: 88% hex:e0 Percentage: 89% hex:e3 percentage: 90% H Ex:e6 percentage: 91% hex:e8 percent: 92% hex:eb percentage: 93% hex:ed Percentage: 94% hex:f0 Percentage: 95% hex:f2 percentage: 96% HEX : F5 percentage: 97% hex:f7    Percentage: 98% hex:fa percentage: 99% hex:fc percent: 100% hex:ff 
Calculation:

Write a simple Java program to:

public class ToHex {    public static void main(String[] args) {        System.out.println("透明度百分比对应的十六进制:");        for (int i = 0; i <= 100; i++) {            float temp=255*i*1.0f/100f;            int round = Math.round(temp);//四舍五入            String hexString = Integer.toHexString(round);            if (hexString.length()<2) {                hexString+="0";            }            System.out.println("    百分比:"+i+"%"+"  HEX: "+hexString.toUpperCase());        }    }    }
Other:

Android 的透明度在alpha 为0~1.在xml中用16进制表示.

For example: Full transparency #00000000 , followed by six 0 for Black, and the front 00 for transparency of 0.

You can also use the calculator 255 * 50% and then switch to programmer mode, you can see the corresponding hexadecimal.

Android transparency percentage corresponds to hexadecimal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.