Right now I have a fragment with a ScrollView that contains a RelativeLayout, that contains a CardView, that contains several EditText children from the rey5137 Material library.
For a few of these EditText children, I want to be able to follow this workflow:
- Click on the EditText and see my keyboard and cursor appear
- Type whatever
- Press Enter and have the keyboard/cursor disappear,
- Repeat as desired
I've tried making it so that I set an OnClickListener for my EditText that setCursorVisible(true), and an OnEditorActionListener that listened for a KeyEvent.KEYCODE_ENTER to hide the soft keyboard and setCursorVisible(false).
And with that, now it goes like this:
- Click EditText field, floating label goes up, cursor is visible, keyboard is visible
- Type stuff
- Press enter, keyboard disappears, cursor disappears, one extra space character is added (I'd ideally like to not have that too?)
- Click EditText field, cursor is not visible, keyboard is visible, I can edit.
Tried messing with focusing too, but that didn't work out too well. But that's just more my lack of understanding of focus than anything.
Aucun commentaire:
Enregistrer un commentaire