简体   繁体   中英

Set focus on an edittext after using

I have an EditText that recieves input and prints in on the screen. I need to find a way wherein after click submit or enter, the phone will focus on the EditText

I tried

txtJoke.setFocusable(true);
txtJoke.setFocusableInTouchMode(true);
txtJoke.requestFocus();

and it doesn't work.. requestfocus works during onCreate.. I'm thinking of manually triggering a click an edittext..

You can use ...

Button newButton.setOnFocusChangeListener(new View.onFocusChangeListener) {....}

to specify where will be the focus go next.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM