繁体   English   中英

Android如何使此EditText渐变

[英]Android How can i make a gradient of this EditText

此颜色代码是给我的:

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;

并要求这是预览,我尝试在我的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>

现在我想和图片一样,但我听不懂。 我该如何设置?

这是获取渐变的正确代码。

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

暂无
暂无

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

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