zoukankan      html  css  js  c++  java
  • 订制EditText光标

    订制EditText光标

    • 设置背景android:background="@null"
    • 设置光标样式:android:textCursorDrawable="@drawable/edit_cursor_line"
     <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
            <size android:width="2dp" />
            <solid android:color="@color/zhiRiRed"  />
        </shape>
    • 去掉或设置光标下的圆点样式:android:textSelectHandle="@drawable/edit_select_handle" 去掉下标可如下设置(直接设置android:textSelectHandle="@null"运行时出错)
     <?xml version="1.0" encoding="utf-8"?>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle" >
            <size android:width="0dp" />
        </shape>

    整体代码如下:

     <EditText
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:background="@null"
             android:textCursorDrawable="@drawable/edit_cursor_line"
             android:textSelectHandle="@drawable/edit_select_handle" />
  • 相关阅读:
    【算法】八皇后问题 Python实现
    【算法】摩尔投票
    【数据结构】 二叉树
    【Manacher算法】最长子回文串
    缓存 和 数据库 数据一致性
    python网络编程
    python网络编程
    python
    算法
    Docker使用
  • 原文地址:https://www.cnblogs.com/shen-hua/p/6991381.html
Copyright © 2011-2022 走看看