Android does not automatically eject the soft keyboard and do not let the soft keyboard eject the extruded graphics

Source: Internet
Author: User

Soft Keyboard Popup Extrusion graphics very perverted, the design of the model will be in the software disk popup data becomes ugly, in order to remain unchanged, just to

Manifest.xml the corresponding Activity to add

Android:windowsoftinputmode= "Adjustpan|statehidden"

In order not to let the software disk pop-up, if it is activity, you can directly add the following code to solve the problem of automatically eject the soft keyboard

  <android:name= "Com.guandehao.baobiao.B_KuCunBaoBiao"             android: Windowsoftinputmode= "Adjustpan|statehidden"            android:configchanges= "orientation |keyboardhidden "/>

There is no activity under the settings may be invalid, such as activityfragment, that directly can use the following methods, the above settings can be preserved.

The first method:

is to add in the parent control of the edittext that does not eject the corresponding software disk.

Android:focusable= "true"
Android:focusableintouchmode= "true"

<xmlns:android= "http://schemas.android.com/apk/res/android"    Android : layout_width= "Match_parent"    android:layout_height= "Match_parent"     android:focusable = "true"           android:focusableintouchmode= "true"     android:orientation= " Vertical ">

This is the most convenient way for me to feel, also some of the following solutions

This is the second method:

Add a hidden TextView to the XML file:

< TextView           Android:id = "@+id/config_hidden"           android:layout_width= "Wrap_content"          android:layout_height= "Wrap_ Content "          android:focusable=" true "          Android:focusableintouchmode  = "true"          />

Then add in the activity:

/** prevent the soft keyboard from popping automatically */          = (TextView) View.findviewbyid (R.id.config_hidden);        Config_hidden.requestfocus ();

I recommend using the first method, concise.

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.