Styling edit text input fields in Android app layout

Android code layout to style edit text input similar to web input fields with different colors around edit text input

create rec_text_edit.xml file in res/drawable folder

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:padding="10dp" android:shape="rectangle" > <solid android:color="#FFFFFF" /> <corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" /> </shape>

In your activity xml file add below line in edittext field,

android:background="@drawable/rect_text_edit"

Below code makes cursor more clearly visible

android:textColor=”@android:color/black” android:textCursorDrawable=”@null”

Sign In or Register to comment.