Using the Code
Create an XML file with the name
" EditTextStyle.xml " in the drawable folder in your
project and write the following code:
<?xml version="1.0"
encoding ="utf-8" ?>
< shape xmlns:android ="http://
schemas.android.com/apk/res/android"
android:thickness ="0dp"
android:shape ="rectangle">
< stroke android:width ="3dp"
android:color ="#4799E8"/>
< corners android:radius ="5dp" />
< gradient
android:startColor="#C8C8C8"
android:endColor ="#FFFFFF"
android:type="linear"
android:angle ="270"/>
</ shape >
Now add the following attribute to your
EditText :
< EditText
android:id ="@+id/
inputSearchEditText"
android:layout_marginLeft ="15dp"
android:layout_marginTop ="15dp"
android:layout_marginBottom ="20dp"
android:layout_marginRight ="15dp"
android:layout_centerVertical ="true"
android:layout_width ="match_parent"
android:layout_height ="wrap_content"
android:ellipsize ="start"
android:gravity ="center"
android:hint ="Search
text"
android:inputType ="text"
android:background ="@drawable/
EditTextStyle" />
Create an XML file with the name
" EditTextStyle.xml " in the drawable folder in your
project and write the following code:
<?xml version="1.0"
encoding ="utf-8" ?>
< shape xmlns:android ="http://
schemas.android.com/apk/res/android"
android:thickness ="0dp"
android:shape ="rectangle">
< stroke android:width ="3dp"
android:color ="#4799E8"/>
< corners android:radius ="5dp" />
< gradient
android:startColor="#C8C8C8"
android:endColor ="#FFFFFF"
android:type="linear"
android:angle ="270"/>
</ shape >
Now add the following attribute to your
EditText :
< EditText
android:id ="@+id/
inputSearchEditText"
android:layout_marginLeft ="15dp"
android:layout_marginTop ="15dp"
android:layout_marginBottom ="20dp"
android:layout_marginRight ="15dp"
android:layout_centerVertical ="true"
android:layout_width ="match_parent"
android:layout_height ="wrap_content"
android:ellipsize ="start"
android:gravity ="center"
android:hint ="Search
text"
android:inputType ="text"
android:background ="@drawable/
EditTextStyle" />
Comments
Post a Comment
"Welcome to my blog, where I, Sandeep Giri, share my passion for the Tech World. Join me on an exciting journey as we explore the latest trends, innovations, and advancements in the world of technology."