2014-12-26 2 views
1

안드로이드 edittext의 배경색을 기준으로 안드로이드 edittext 커서 색상을 변경하는 방법 (동적)? edittext에 어두운 배경색을 선택하면 커서가 밝아집니다. 어두운 배경을 선택하면 edittext의 색상은 커서가 어두울 것입니다. edittext 색상 변경시 커서 색상이 런타임에 변경됩니다. 어떤 아이디어라도 환영합니다.안드로이드 edittext 커서 색상을 동적으로 변경합니다.

답변

1

이 속성은 안드로이드를 작동 추가하려고 : textCursorDrawable

< EditText 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:textCursorDrawable="@drawable/color_cursor" 
/> 
0
Field f = null; 
f = TextView.class.getDeclaredField("mCursorDrawableRes"); 
f.setAccessible(true); 
f.set(editText, R.drawable.color); 
+0

우리가 포인터의 색상을 변경하려면? 당신도 나에게 여기에서 대답 할 수있다. http://stackoverflow.com/questions/41240065/edittext-cursor-and-pointer-color-for-below-android-5-0 –

관련 문제