简体   繁体   中英

Soft keyboard remains visible after changing tabs

我的主屏幕上有四个选项卡,其中一个用于接受用户输入。在输入选项卡中输入数据时,键盘会打开。当我切换到其他选项卡时,此键盘将保持打开状态。有关我需要做什么的任何建议?

The following code is copied from Close/hide the Android Soft Keyboard .

Next time, please, search the forum before posting a question:

tabHost.setOnTabChangedListener(new OnTabChangeListener()
        {
        public void onTabChanged(String tabId)
            {
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(tabHost.getApplicationWindowToken(), 0);
            }
        }

this may helps you , in your Manifest with Activity declaire like this

<activity android:windowSoftInputMode="adjustResize" />

or

<activity android:windowSoftInputMode="adjustPan" /> for more info 

see Here

or

<activity
        android:name=".Home"
        android:configChanges="keyboardHidden|orientation">
    </activity>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM