带删除功能的edittext

来源:互联网 发布:ubuntu tracert命令 编辑:程序博客网 时间:2024/04/28 14:17
<RelativeLayout    android:layout_width="match_parent"    android:layout_height="?attr/actionBarSize"    android:layout_marginTop="24dp">    <EditText        android:id="@+id/et_name"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:maxLength="16"        android:paddingLeft="16dp"        android:textSize="18sp"        android:background="@null"/>    <ImageView        android:id="@+id/iv_cancel"        android:layout_width="20dp"        android:layout_height="20dp"        android:src="@mipmap/cancel"        android:layout_marginRight="10dp"        android:layout_centerVertical="true"        android:layout_alignParentRight="true"        android:layout_alignParentEnd="true" /></RelativeLayout>
在imageview中添加点击事件,将edittext的内容置为null
0 0