修改edittext的光標顏色

1.在drawable中建立一個xml文件,我的文件名是login_edittext,文件內容:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <size android:width="1dp" />
    <span style="font-family: Arial, Helvetica, sans-serif;">1dp</span>
    <solid android:color="@color/appcolors" /><!-- 光標顏色可以自己定義 -->
</shape>

2.在控件中加上一個屬性:

android:textCursorDrawable="@drawable/login_edittext"

3.大功告成。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章