Yugesh
Yugesh

Reputation: 4092

How to move the popup window when the virtual kayboard is open in android?

I have EditText and Button in popup-window.am show popup-window in bottom of the screen. When i try to enter details in EditText, the popup-window hide behind the soft-keyboard,not able to see the EditText and not able to solve the issue.Can any one know help me to solve this issue.

popup-window code

search_popup_inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
search_popup_view = search_popup_inflater.inflate(R.layout.search_popup, null, true);
search_popup = new PopupWindow(search_popup_view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,true);

search = (EditText) search_popup_view.findViewById(R.id.search);
btn_search_enter = (Button) search_popup_view.findViewById(R.id.btn_search);

After Button Click Show popup

search_popup.setBackgroundDrawable(new BitmapDrawable());

        search_popup.setTouchInterceptor(new OnTouchListener() {
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {

                    search_popup.dismiss();

                    return true;
                }
                return false;
            }
        });

        //search_popup.showAtLocation(findViewById(R.id.line_lay), Gravity.TOP, locateView(view).left, locateView(view).bottom);
        search_popup.showAtLocation(findViewById(R.id.line_lay), Gravity.BOTTOM, 0, v.getHeight());

Upvotes: 0

Views: 313

Answers (1)

nithin
nithin

Reputation: 2467

Try using

android:windowSoftInputMode="adjustPan|adjustResize"

in the activity manifest file.

Upvotes: 1

Related Questions