简体   繁体   中英

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. 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

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) .

If you translate this to hex values you should replace "yourStartColour" with "#012F58" and "yourEndColour" with "#00488C"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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