[Android] the soft keyboard does not support actionSearch when using SearchView

Source: Internet
Author: User

Preface

Abnormal problems often occur. This year, there are many special issues, such as,--# The unhandled problem encountered today. Otherwise, the SearchView cannot be used in HTC One S, and its soft keyboard does not support action settings.

 

Statement

You are welcome to repost, but please keep the original source of the article :)

Blog: http://www.cnblogs.com

Farmer's uncle: http://www.cnblogs.com/over140/

 

Body

Faulty device:

HTC One S

 

Searchable. xml

<Searchable xmlns: android = "http://schemas.android.com/apk/res/android"
Android: label = "@ string/search_label"
Android: hint = "@ string/search_hint"
Android: voiceSearchMode = "showVoiceSearchButton | launchRecognizer"
Android: imeOptions = "actionSearch"
Android: searchSuggestAuthority = "com. xxx. provider. searchsuggestion"
Android: searchSuggestSelection = "? "/>

Solution:

SearchView has a setSubmitButtonEnabled method, which is set to true. The search box is displayed if it is not empty. The effect is as follows:

 

Call inflate in onCreateOptionsMenu. Remember to judge the API Level.

Related Article

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.