Android XML可绘制透明渐变
我想澄清一下 HTML 颜色代码前面的代码的名称及其工作原理。
1) 我假设,在下面的示例中,#00000000
的 endColor
以及前面的两个 00
告诉要生成更多颜色比说 FF
更透明。
2)但是规模是多少?
3)是否有某种相当于某些百分比的十六进制比例?
我真的很困惑,找不到任何文档,因为我什至不确定除了“xml透明渐变”之外我应该搜索的术语,它并没有告诉我我想知道什么。
感谢任何/所有帮助。谢谢
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#DD63594A"
android:endColor="#00000000"
android:angle="90"/>
<padding android:left="4dp"
android:top="1dp"
android:right="4dp"
android:bottom="1dp" />
<corners android:bottomRightRadius="1dp" android:bottomLeftRadius="1dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
I would like some clarification on what the code in front of the HTML color code is called and how it functions.
1) I'm assuming, in the example below, the endColor
of #00000000
with the two preceding 00
tells the color to be generated more transparent than say FF
.
2) But what's the scale?
3) Is there some kind of hex scale that equates to certain percentages?
I'm really confused and can find no documentation because I'm not even sure of the the terminology I should be searching for other than 'xml transparent gradient' which doesn't tell me what I want to know.
Any/All help is appreciated. Thanks
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#DD63594A"
android:endColor="#00000000"
android:angle="90"/>
<padding android:left="4dp"
android:top="1dp"
android:right="4dp"
android:bottom="1dp" />
<corners android:bottomRightRadius="1dp" android:bottomLeftRadius="1dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它是十六进制的。比例与颜色代码其余部分中的 RGB 值相同,因此
00
将是alpha=0
,FF
将是 <代码>alpha=255。基本的数学解释了其余的事情。It's hexadecimal. The scale is the same as the RGB values in the rest of the color code, so
00
would bealpha=0
andFF
would bealpha=255
. Basic math explains the rest.