如何自定义EditText
的下划线,如下所示?
答案 0 :(得分:4)
你可以做这样的事情
<EditText
android:id="@+id/editRemarks"
android:layout_below="@+id/addNoteRemarks"
android:gravity="left"
android:layout_centerHorizontal="true"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/edit_text_shape"/>
及以下是可绘制文件&#34; edit_text_shape&#34;
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<!-- Draw a 2dp width border around shape -->
<stroke
android:color="@color/viewfinder_laser"
android:width="2dp"
/>
</shape>
</item>
<!-- Overlap the left, top and right border using background color -->
<item
android:bottom="2dp"
>
<shape android:shape="rectangle">
<solid android:color="@color/white"/>
</shape>
</item>