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 =.=!
The percentage of transparency corresponds to 16: (Note: The percentage is calculated as a decimal, according to the regular rounding process, see below for details)      percent:0%  hex: 00      percent:1%  hex: 30     percent:2%  hex: 50      percent:3%  hex: 80     percent:4%  hex: a0      percent:5%  hex: d0     percent:6%  hex: f0      percent:7%  hex: 12     percent:8%  hex: 14      percent:9%  hex: 17     percent:10%  hex: 1a      percent:11%  hex: 1c     percent:12%  hex: 1f      percent:13%  hex: 21     percent:14%  hex: 24      percent:15%  hex: 26     percent:16%  hex: 29      HundredPercentage of:17%  hex: 2b    :18%  hex: 2e     Percent:19%  hex: 30     percent:20%  hex: 33     Percent:21%  hex: 36     percent:22%  hex: 38     Percent:23%  hex: 3b     percent:24%  hex: 3d     Percent:25%  hex: 40     percent:26%  hex: 42     Percent:27%  hex: 45     percent:28%  hex: 47     Percent:29%  hex: 4a     percent:30%  hex: 4d     Percent:31%  hex: 4f     percent:32%  hex: 52     Percent:33%  hex: 54     percent:34%  hex: 57     Percentage: 35%  hex: 59     percent:36%  hex: 5c     percent: 37%   HEX: 5E     percent:38%  hex: 61     percentage: 39%   HEX: 63     percent:40%  hex: 66     percentage: 41%   HEX: 69     percent:42%  hex: 6b     percentage: 43%   HEX: 6E     percent:44%  hex: 70     percentage: 45%   HEX: 73     percent:46%  hex: 75     percentage: 47%   HEX: 78     percent:48%  hex: 7a     percentage: 49%   HEX: 7D     percent:50%  hex: 80     percentage: 51%   HEX: 82     percent:52%  hex: 85     percentage: 53%   hex: 87     percent:54%  hex: 8a     percent:55%   hex: 8c     percent:56%  hex: 8f     percent:57%   hex: 91     percent:58%  hex: 94     percent:59%   hex: 96     percent:60%  hex: 99     percent:61%   hex: 9c     percent:62%  hex: 9e     percent:63%   hex: a1     percent:64%  hex: a3     percent:65%   hex: a6     percent:66%  hex: a8     percent:67%   hex: ab     percent:68%  hex: ad     percent:69%   hex: b0     percent:70%  hex: b3     percent:71%   Hex: b5     percent:72%  hex: b8     percentage: 73%  hex: ba      percent:74%  hex: bd     percentage: 75%  HEX: BF      percent:76%  hex: c2     percentage: 77%  hex: c4      percent:78%  hex: c7     percentage: 79%  hex: c9      percent:80%  hex: cc     percentage: 81%  HEX: CF      percent:82%  hex: d1     percentage: 83%  hex: d4      percent:84%  hex: d6     percentage: 85%  hex: d9      percent:86%  hex: db     percentage: 87%  hex: de      percent:88%  hex: e0     percentage: 89%  hex: e3      percent:90%  hex: e6     percent:91%  hex: e8      percent:92%  hex: eb     percent:93%  hex: ed      percent:94%  hex: f0     percent:95%  hex: f2      percent:96%  hex: f5     percent:97%  hex: f7      percent:98%  hex: fa     percent:99%  hex: fc      percentage: 100%  hex: ff
Calculation:

Write a simple Java program to:

Public class tohex {    public static void main (String[]  args)  {        system.out.println ("16 Binary for Transparency percentage:");         for  (int i = 0; i <= 100;  i++)  {            float temp=255*i *1.0f/100f;            int round =  Math.Round (temp);//Rounding             String  Hexstring = integer.tohexstring (Round);             if  (Hexstring.length () <2)  {                 hexstring+= "0";             } &nBsp;          system.out.println ("     Percentage: "+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

Related Article

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.