Android颜色值(#AARRGGBB)透明度百分比和十六进制对应关系以及计算方法

来源:互联网 发布:js修改css样式display 编辑:程序博客网 时间:2024/05/20 16:43

透明度百分比和十六进制对应关系表格

透明度十六进制100%FF99%FC98%FA97%F796%F595%F294%F093%ED92%EB91%E890%E689%E388%E087%DE86%DB85%D984%D683%D482%D181%CF80%CC79%C978%C777%C476%C275%BF74%BD73%BA72%B871%B570%B369%B068%AD67%AB66%A865%A664%A363%A162%9E61%9C60%9959%9657%9456%9156%8F55%8C54%8A53%8752%8551%8250%8049%7D48%7A47%7846%7545%7344%7043%6E42%6B41%6940%6639%6338%6137%5E36%5C35%5934%5733%5432%5231%4F30%4D28%4A28%4727%4526%4225%4024%3D23%3B22%3821%3620%3319%3018%2E17%2B16%2915%2614%2413%2112%1F11%1C10%1A9%178%147%126%0F5%0D4%0A3%082%051%030%

00


透明度百分比和十六进制对应关系计算方法

public void switch() throws Exception {        System.out.println("透明度 | 十六进制");        System.out.println("---- | ----");        for (double i = 1; i >= 0; i -= 0.01) {            i = Math.round(i * 100) / 100.0d;            int alpha = (int) Math.round(i * 255);            String hex = Integer.toHexString(alpha).toUpperCase();            if (hex.length() == 1) hex = "0" + hex;            int percent = (int) (i * 100);            System.out.println(String.format("%d%% | %s", percent, hex));        }}


0 0
原创粉丝点击