android - EditText different state after user inserting content -
i have 2 edittext 2 states. focused state , default state.
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:drawable="@drawable/focused" /> <item android:drawable="@drawable/not_focused" /> </selector> this working expected , states differ in background (color, etc).
i've added setonfocuschangelistener on edittext detect focus.
how can set state of edittext same focused state if have content in edittext? (for example after user inserting input)?
in setonfocuschangelistener can detect edittext focused , if has content can't figure out how maintain focused state, is, same background
you can use textwatcher check when text changes, inside that, add if, inside if check if edittext different null, and, add code.
what do, anytime text inside edittext changes, call if , see wether or not has text inside , accordingly change it.
Comments
Post a Comment