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. You cannot close the popupwindow when switching from handwritten input to voice input. Otherwise, the content entered earlier will be gone. There is A conflict: A. If you want to pop up A soft keyboard when you click EditText, you have to set popupwinodw. setFocusable (true); B. To prevent the popupwinodw from disappearing when the speaker button outside the popupwindow is clicked, set the popupwindow. setFocusable (false) www.2cto.com. 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, the pop-up soft keyboard appears at the bottom layer of popupwinow and is hidden by popupwindow. Do you understand what I mean? If you do, hope to make a move !!! The following figure shows the situation

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: info-contact@alibabacloud.com 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.