Android N (7.0) in the ListView display EditText when the soft keyboard pops up automatically switch to the full keyboard problem?

Source: Internet
Author: User
Tags switches

Android N (7.0) when the soft keyboard pops up when the edittext is displayed in the ListView, will it automatically switch to the full keyboard? Problem symptom Description
    1. Activity is set in Androidmanifest.xml.android:windowSoftInputMode="adjustPan"
    2. Draw Item in ListView
    3. The item control is EditText
    4. EditText setting InputType to Number
    5. When you click EditText on the Android 7.0 system, the soft keyboard that pops up is "digital" input mode, but instantly switches to "full keyboard" mode.

      No such problem occurred in the system before 7.0.

A tentative solution (risk not evaluated)
 /** * Tried to fix the problem that the pop-up soft keyboard automatically switches from the numeric keypad to the English full keyboard when displaying EditText InputType as other non-text types in the ListView. */class ListViewEx2 extends Listview{public ListViewEx2 (final context context) {super (context);} Public ListViewEx2 (Final context context, final AttributeSet attrs) {Super (context, attrs);} Public ListViewEx2 (Final context context, final AttributeSet attrs, final int defstyleattr) {Super (context, Attrs, DefS TYLEATTR);} @TargetApi (build.version_codes. LOLLIPOP) Public ListViewEx2 (final context context, final AttributeSet attrs, final int defstyleattr, final int defstyleres ) {Super (context, Attrs, defstyleattr, defstyleres);} @Overrideprotected void OnLayout (Final boolean changed, Final int l, final int T, final int R, final int b) {//xxx: After preliminary    Test, only the Android 7.0 platform above the system will appear on the soft keyboard automatic switching problem. if (Build.VERSION.SDK_INT >= build.version_codes.    N && changed) super.onlayout (changed, L, T, R, b); else Super.onlayout (changed, L, T, R, b);}}  
Listview.java Source Comparison

Android version Name: Nougat API level:24 Listview.java Online View

Android 7 part of suspicious changed source code

  Private class Focusselector implements Runnable {//The selector is waiting to set selection on the list VI    EW private static final int state_set_selection = 1; The selector set the selection on the list view, waiting for a Layoutchildren pass private static final int State_wa    It_for_layout = 2;    The selector ' s selection has been honored and it's waiting to request focus on the/target child.    private static final int state_request_focus = 3;            public void Run () {if (maction = = state_set_selection) {setselectionfromtop (mposition, mpositiontop);        Maction = State_wait_for_layout;            } else if (maction = = State_request_focus) {final int childindex = mposition-mfirstposition;            Final View child = Getchildat (Childindex);            if (child! = null) {Child.requestfocus ();        } maction =-1; }    }    }}

Android version name: Marshmallow API level:23 Listview.java Online View

Android 6 part of suspicious changes to the old version of the source code

private class FocusSelector implements Runnable {           public void run() {        setSelectionFromTop(mPosition, mPositionTop);    }    }
Resources
    • Keyboard-issue with Edittext InputType & Focus Android N (7.0)-Stack Overflow

Android N (7.0) in the ListView display EditText when the soft keyboard pops up automatically switch to the full keyboard problem?

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.