How I could achieve something like this in edittext? add like an indicator to hint about the typed text
r
rahul_lohra
07/13/2020, 8:54 PM
Maybe you can try below
ADD VIEWS TO ACTIVITY (2 ways) -
1. Treat this indicator like Android Toast - in this way you don't have to make any changes in your activity/fragment layout
2. Create FrameLayout as parent of this EditText and then you add this indicator to this frameLayour
HANDLE POSITION OF INDICATOR -
1. We need to ensure that the indicator should always be to the RIGHT of TEXT
2. For this I think we need to calculate width of the
written text
. We can use editText.addTextChangeListen.... from here you can get the width of the written text
3. After getting width of written text just translate your indicator.
4. Do remember to handle edge-case what if no space is left to draw the indicator, then just translate it on Y axis