简体   繁体   English

Edittext和软键盘问题

[英]Issue with Edittext and softkeyboard

Having Problem with Edittext and SoftKeyboard. Edittext和SoftKeyboard出现问题。

这是您好编辑文本的屏幕

now if i click on edittext(hello text) to modify it (means when it gains focus bottom gridview is poping up see second image) 现在,如果我单击edittext(hello text)对其进行修改(意味着当它获得焦点时,底部gridview会弹出,请参阅第二张图片)

在此处输入图片说明

so how to change this behaviour of poping up the bottom views ? 那么如何改变这种弹出底视图的行为呢?

Any Help will be greately appreciated. 任何帮助将不胜感激。

Thanks in advance. 提前致谢。

您可以打开对话框,并在对话框中添加EditText,然后单击确定按钮,可以根据在对话框edittext中添加的文本来更改该文本。

android:windowSoftInputMode="adjustResize"属性可能会挤压背景,请改用android:windowSoftInputMode="stateVisible|adjustPan"

View activityRootView;

activityRootView = (LinearLayout) findViewById(R.id.root); // main layout id


activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(
                new OnGlobalLayoutListener() {
                    @Override
                    public void onGlobalLayout() {
                        int heightDiff = activityRootView.getRootView()
                                .getHeight() - activityRootView.getHeight();
                        if (heightDiff > 100) {
                            // if more than 100 pixels, its

                            // hide your below layout like layout1.setVisibility(View.GONE);

                        } else {
                         // visible your below layout like layout1.setVisibility(View.VISIBLE);


                        }
                    }
                });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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