android 半透明色值"/>
android 半透明色值
透明度表格
透明度百分比和十六进制对应关系计算方法:@Test
public void rgba() 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));
}
}
不透明度表格
不透明度百分比和十六进制对应关系计算方法:public void rgba() throws Exception {
System.out.println("不透明度 | 十六进制");
System.out.println("---- | ----");
for (int percent = 0; percent <= 100; percent++) {
int alpha = Math.round(255 * percent * 1.0f / 100f);
String hex = Integer.toHexString(alpha).toUpperCase();
if (hex.length() == 1) {
hex = "0" + hex;
}
System.out.println(String.format("%d%% | %s", percent, hex));
}
}
用于查询。本文整理来自:
更多推荐
android 半透明色值
发布评论