EditText光標的顏色設定
xml
android:textCursorDrawable="@null"
程式碼
try {
Field f = TextView.class.getDeclaredField("mCursorDrawableRes");
f.setAccessible(true);
f.set(yourEditText, R.drawable.cursor);
} catch (Exception ignored) {
}
全選EditText裡的字
editText.setSelection(0, length);
editText.setSelection(0);
editText.setSelectAllOnFocus(true);
沒有留言:
張貼留言