<EditText android:id="@+id/txtpin"
android:maxLength="4"
android:layout_marginLeft="10dp"
android:layout_height="37dp"
android:gravity="center_horizontal"
android:inputType="textPassword"
android:longClickable="false"
android:layout_width="160dp"
android:shadowColor="@color/Black"
android:shadowDx="1.2"
android:shadowDy="1.2"
android:shadowRadius="1.5"
android:background="@color/White">
<requestFocus></requestFocus>
</EditText>
Với cách này thì bạn chỉ tạo được shadown text bên trong EditText. Cách dưới sẽ phù hợp hơn
Vào res/drawable/edittext_shadow.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- most important is order of layers -->
<!-- Bottom right side 2dp Shadow -->
<item >
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
<!-- Bottom 2dp Shadow -->
<item>
<shape android:shape="rectangle">
<solid android:color="#000000" />
</shape>
</item>
<!-- White Top color -->
<item android:bottom="3px" android:right="3px">
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
Sau đó vào res/layout/main.xml
<EditText android:layout_width="wrap_content"
android:id="@+id/txtpin"
android:maxLength="4"
android:layout_height="37dp"
android:gravity="center_horizontal"
android:longClickable="false"
android:padding="2dp"
android:inputType="textPassword|number"
android:password="true"
android:background="@drawable/edittext_shadow"
android:layout_weight="0.98"
android:layout_marginLeft="15dp">
<requestFocus></requestFocus>
</EditText>