Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
263 views
in Technique[技术] by (71.8m points)

java - Customize Edittext and Button

enter image description here I want to create edittext and button like this. I am not able to create the bottom shadow and round corner. please help me to design the xml.

This is my xml code

<item>
    <shape android:shape="rectangle">
        <solid android:color="#2CB386" />
        <corners android:radius="5dp"/>
    </shape>
</item>

<item android:bottom="5px">
    <shape android:shape="rectangle">
        <solid android:color="#F5F2F2" />

    </shape>
</item>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Deep Green shadow. -->
<item android:left="3dp" android:top="5dp">
    <shape>
        <solid android:color="#046A4B" />
        <corners android:radius="15dp" />
    </shape>
</item>
<!-- Green foreground. -->
<item android:bottom="5dp" android:right="3dp">
    <shape>
        <solid android:color="#2CB386" />
        <corners android:radius="15dp" />
    </shape>
</item>

Create a button_bg.xml file under drawable folder and set your button background to button_bg.xml

android:background="@drawable/button_bg"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...