hello all i need to remove the edittext default style i want to remove the selected portion from both the side on focus of edittext or on normal edittext i just want the simple black line on normal edittext and blue line on focus
I have created 1 xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape android:shape="line">
<!-- Draw a 2dp width border around shape -->
<stroke android:width="1dp" android:color="@color/blue" />
</shape>
<!-- Overlap the left, top and right border using background color -->
<item
android:bottom="1dp"
>
<shape android:shape="rectangle">
<solid android:color="@color/white"/>
</shape>
</item> <!-- pressed -->
</item>
<item android:state_focused="true"><shape android:shape="rectangle">
<!-- Draw a 2dp width border around shape -->
<stroke android:width="1dp" android:color="@color/blue" />
</shape></item>
<!-- focused -->
<item><shape android:shape="rectangle">
<!-- Draw a 2dp width border around shape -->
<stroke android:width="1dp" android:color="@color/orange" />
</shape></item>
<!-- default -->
</selector>
but it giving me RECTANGLE i just want LINE @bottom
Try this code:
edit_text.xml
Put the Xml file in Drawable Folder (custom_edit_text_black_line.xml)
Put the Xml file in Drawable Folder (custom_edit_text_blue_line.xml)
And in Activity write the below code :
Create the new xml file inside drawable folder. lets say
a.xml
Create another new xml file in drawable, lets say
b.xml
Create another new xml file in drawable. lets say
c.xml
Try this code.
this is a selector file. it has to be made background to the edittext. selector automatically switches between two drawable file acording to its (edittext's) state.
Using This EditText
Use
Selector
for differentedittext
states:and your drawable would be as Jayanth sample:
Use properties that define color for edit text that is
colorControlActivated
,colorControlHighlight
andcolorControlNormal
in your app theme forstyle.xml
.