简体   繁体   中英

Android How can i make a gradient of this EditText

This colour code is given to me:

background-image:-moz-linear-gradient(53% 0% -90deg,rgb(255,255,255) 0%,rgb(204,204,204) 100%); 
background-image:linear-gradient(-90deg,rgb(255,255,255) 0%,rgb(204,204,204) 100%);
width:787px;
height:142px;
border-color:rgb(221,221,221);
border-width:1px;
border-style:solid;

And ask for this this is a preview I try This code in my background of edittext

 <?xml version="1.0" encoding="utf-8"?>
    <!--  res/drawable/rounded_edittext.xml -->
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" android:padding="10dp">
            <solid android:color="#FFFFFF"/>

            <corners
                android:bottomRightRadius="20dp"
                android:bottomLeftRadius="20dp"
                android:topLeftRadius="20dp"
                android:topRightRadius="20dp"/>
            <gradient
                android:startColor="#ffcccccc"
                android:centerColor="#e7e7e8"
                android:type="linear"
                android:endColor="#ffcccccc"
                android:angle="90" />
      <stroke android:color="#ffdddddd"
            android:width="2dp"/>
        </shape>

Now I want same as picture but i cant get It. How can i set this ?

This the right code for getting gradient.

     <gradient android:startColor="#ffcccccc" 
android:type="linear"
  android:centerColor="#e7e7e8"
 android:endColor="#fff5f5f6" 
android:angle="90" /> 

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