Android 設置EditText的光標顏色和粗細

在android的輸入框裏,如果要修改光標的顏色及粗細步驟如下兩步即可搞定:
1.在資源文件drawable下新建一個光標控制color_cursor.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <size android:width="1dp" />
    <solid android:color="#008000"  />
</shape>

2.設置EditText:android:textCursorDrawable="@drawable/color_cursor"
發佈了32 篇原創文章 · 獲贊 9 · 訪問量 6萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章