【发布时间】:2018-06-23 21:28:46
【问题描述】:
我想将 css 渐变转换为 android xml 渐变(形状)文件
例如
background-image: linear-gradient(to right, #ff8177 0%, #ff867a 0%, #ff8c7f 21%, #f99185 52%, #cf556c 78%, #b12a5b 100%);
到
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="0"
android:endColor="#b12a5b"
android:startColor="#ff867a"
android:type="linear" />
</shape>
我对 CSS 了解不多。我只知道android,颜色只有三个参数android:endColor,android:startColor,android:centerColor如何定义这个百分比和css中呈现的各种颜色
是否有任何在线工具可以通过提供 css 输入生成 xml 文件。
【问题讨论】:
-
虽然我认为@Matthew Schlachter给出的答案已经足够了。但是由于您还没有接受,我想知道您是否需要更多帮助?
-
@RoyalGriffin 嘿,我没有时间测试它。一旦我测试它,我会接受答案:)