How to make a yellow frame around EditText ?

And then how to change the color of this frame? :)

Here is the yellow frame:

enter image description here

  • What do you mean by frame? > В Eclipse у меня она появлялась автоматически - the development environment does not affect the appearance of the application, the difference may be due to different target versions of the Android API - ermak0ff
  • @ ermak0ff, apparently the style was different. Photo frame added to the question. - user189127

1 answer 1

as I understand you need it

This is an EditText

Create the EditTextStyle.xml file in the drawable folder

 <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> 

Add an attribute to EditText android:background="@drawable/EditTextStyle"

 <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"/> 

should help ( in English )

UPD:

And then how to change the color of this frame? :)

change these lines

 ... <stroke android:width="3dp" android:color="#4799E8"/> ... android:startColor="#C8C8C8" android:endColor="#FFFFFF" ... 

UPD 2:

How to increase the indent of the blue frame from the text? It fits tight

for this you need to add padding to EditText

 <EditText android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="10dp" android:paddingBottom="10dp" ... 
  • I'm going to try now. - user189127
  • one
    android:padding="8dp" - Saidolim
  • one
    <EditText android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="10dp" android:paddingBottom="10dp" - Saidolim
  • one
    Thank you :))). - user189127
  • one
    Thank you, good luck. !! - Saidolim