如何在编辑文本中添加模糊阴影? [英] How to add a blurred shadow to an edit text?
问题描述
我想为编辑文本添加模糊的阴影,但是我不知道如何? 我已经制作好形状,但是我不知道将模糊添加到编辑文本的属性. 我制作了一个可绘制的资源文件,并将其作为我的编辑文本的背景,但它看起来并不像图片一样 这是我的代码.
I want to add a blurred shadow for my edit text but I don't know how? I had made the shape but I don't know the attribute for adding blur to the edit text. I made a drawable resource file and make this as a background to my edit text but it doesn't look as the picture and this my code.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- "shadow" -->
<item >
<shape android:shape="rectangle" >
<solid android:color="#E8E9ED"
/>
<corners android:radius="20dp" />
</shape>
</item>
<item android:bottom="5px"
android:left="5px"
android:right="5px"
android:top="5px">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<corners android:radius="20dp" />
</shape>
</item>
</layer-list>
推荐答案
属性:android:shadowColor
,android:shadowRadius
,android:shadowDx
和android:shadowDy
创建文本阴影.如果要在edittext框后面创建阴影,则必须在res/drawable文件夹中创建自定义XML视图.然后设置属性android:background ="@ drawable/ customFileName "在您的main.xml中的edittext块中.以下是帮助您入门的答案的链接:将阴影效果添加到EditText字段
The attributes: android:shadowColor
, android:shadowRadius
, android:shadowDx
, and android:shadowDy
create text shadow. If want to create a shadow behind your edittext box, you have to create a custom XML view in your res/drawable folder. Then set the attribute android:background="@drawable/customFileName" in your main.xml inside the edittext block. Here is a link to an answer to help you get started: Add drop shadow effects to EditText Field
这篇关于如何在编辑文本中添加模糊阴影?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!