光標(biāo)顏色和文字顏色相同
android:textCursorDrawable="@null"此時(shí)光標(biāo)顏色與字體顏色相同,寬度為最窄。
實(shí)現(xiàn)自己自定義的光標(biāo)樣式 在drawable文件夾下新建一個(gè)樣式xml文件custom_cursor.xml。其中的代碼為:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#00bb9c"/> <size android:width="2dp"/> </shape>EditText設(shè)置textCursorDrawable的屬性:
android:textCursorDrawable="@drawable/editcursor"這樣就實(shí)現(xiàn)了光標(biāo)樣式的自定義。 注意:該屬性中不能直接寫顏色,因?yàn)闆]有寬度的話,光標(biāo)是無法顯示的。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注