Problems and exploration of edittext and soft keyboard in popupwindow

Source: Internet
Author: User

A problem occurs:

An activity with only one recording button on it.

A popupwindow, click the recording button, and issue a command to bring up the popupwindow.

Popwindow contains an edittext. Click the text box and a soft keyboard will pop up for handwriting input. Click the speaker to switch to the voice input. It cannot be switched from handwritten input to voice input.

Close the popupwindow. Otherwise, the content entered earlier will disappear.

There is a conflict:

A. to pop up the soft keyboard when you click edittext, you must set popupwinodw. setfocusable (true );

B. Set popupwindow. setfocusable (false) to prevent the popupwinodw from disappearing when you click the speaker button outside the popupwindow)

These two fires are not acceptable.

Later, I found a method:

Step 1: popupwindow. setfocusable (false );

Step 2: manually set the ontouch listener for edittext. The soft keyboard is displayed:

Inputmethodmanager M = (inputmethodmanager) Context. getsystemservice (context. input_method_service );
M. togglesoftinput (inputmethodmanager. show_forced, inputmethodmanager. hide_implicit_only );

However, it was tragic to find that the pop-up soft keyboard appeared at the bottom layer of popupwinow and was hidden by popupwindow.

Do you understand what I mean? If you do, hope to make a move !!!

In a word, I want to call up the system keyboard in the case of popupwindow. setfocusable (false) and implement the input

Recently: I solved it in one way. Check whether the keyboard is displayed by detecting the layout height. : Http://

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.