简体   繁体   English

Android 如何将此 CSS 代码转换为 style.xml

[英]Android How too convert this CSS code into style.xml

Hi this syntax is new for me.嗨,这个语法对我来说是新的。 I want to convert it into style in android.我想在android中将其转换为样式。 anybody describe this?有人描述这个吗?

background-image:-moz-linear-gradient(46% -217% -90deg,rgb(1,47,88) 0%,rgb(0,72,140) 100%); 
background-image:linear-gradient(-90deg,rgb(1,47,88) 0%,rgb(0,72,140) 100%);
width:788px;
height:143px;

1) I want start colour 2) I want center Colour 3) I want End Colour 4) I want an angle 1) 我想要开始颜色 2) 我想要中心颜色 3) 我想要结束颜色 4) 我想要一个角度

LIKE喜欢

Your code would be something like this您的代码将是这样的

<shape>
    <gradient
        android:angle="90"
        android:startColor="yourStartColour"
        android:endcolor="yourEndColour"
        android:type="linear" />
</shape>

This is the basic code for a selector, which you set as your background.这是选择器的基本代码,您将其设置为背景。 android:background="@drawable/yourSelector"

Edit: The start and end colour you are searching are these rgb(1,37,88) and rgb(0,72,140) .编辑:您正在搜索的开始和结束颜色是这些rgb(1,37,88)rgb(0,72,140)

If you translate this to hex values you should replace "yourStartColour" with "#012F58" and "yourEndColour" with "#00488C"如果将其转换为十六进制值,则应将"yourStartColour"替换为"#012F58" ,将"yourEndColour"替换为"#00488C"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM