I am writing some text in EditText
when i write "#data" its colour should be changed but doesn't change how can i do. Please check the below EditText
which i have used
<EditText
android:id="@+id/et_simple"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</EditText>
Hope this solution will help..!
I used this solution it is very useful! like adding the textWatcher interface over your editText and listening to textChange and finding out if the word starts with a hashTag then call the Change The color method on that word! it has some flaws but those are ignorable see this simple one here.
Kotlin
Complete solution with custom attributes
This is how you can enable tagging for the EditText
EDIT :
The above mechanism does not work in case you delete any char or your edit text is multiline, the below should work :
Or if you like extensions as I do, this can be refactored as