我想定製EditText滑塊樣式。看到我下面的截圖。Android如何更改edittext光標樣式
這是默認的滑蓋造型:
這是我希望看到的:
這可能是一個愚蠢的問題,但幾個小時後,谷歌搜索,我只能找到更改光標顏色的方法,但找不到更改滑塊樣式的方法。
這是我使用用於改變光標顏色(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="2dp" />
<solid android:color="#008000" />
</shape>
我施加的 「機器人:textCursorDrawable =」 @繪製/ color_cursor」到的EditText
感謝
檢查了這個光標是在材料設計庫中可用http://stackoverflow.com/questions/6225995/can-i-change-the-cursor-size-in-android-edit-text-field –
。將您的EditText包裝在TextInputLayout中。 – Emil
你可以試試android:textCursorDrawable(...) – GiapLee