0

I hard to implement popup like softkeyboard. I mean, when you open popup in android the views under popup is disable (you can't do anything until the popup dismiss). But when then softkeyboard open, the views always above the softkeyboard.

Note : dont need trick like view.setVisibility(View.GONE) or view.setVisibility(View.VISIBLE)

EDIT

As simply, how to make layout/view up when popup display from bottom to up look like softkeyboard?

R Besar
  • 574
  • 1
  • 5
  • 12
  • 1
    If you are using material theme and building with latest api, then you can look for BottomSheet - https://material.google.com/components/bottom-sheets.html# and http://android-developers.blogspot.in/2016/02/android-support-library-232.html – Shadow Droid Sep 02 '16 at 05:14
  • @ShadowDroid : hard to implement that because my layout is complicated and not using that materials – R Besar Sep 02 '16 at 05:42

2 Answers2

0

For this you have to create a custom view that pop up,you have to create a different xml file for your view and define the height width of that,make height wrap content.And your views are not affected by this like other Dialog popup which disable anything in the background.

Example :- lets say you have xml for pop up named dialog_pop_up,

 public void showPopUpDialog(Context context,ImageView imagebuttonPopUP) {
    try {
        View v = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.dialog_pop_up, null, false);

        int[] location = new int[2];
        //This is the button which triggers pop up
        imagebuttonPopUP.getLocationOnScreen(location);

        //Initialize the Point with x, and y positions
        Point p = new Point();
        p.x = location[0];
        p.y = location[1];

        int popupWidth = mActivity.getResources().getDimensionPixelOffset(R.dimen.home_screen_dialog_width);//Utility.dpToPx(mActivity,133);
        int OFFSET_Y = imagebuttonPopUP.getHeight();
        int OFFSET_X = imagebuttonPopUP.getWidth();
        final PopupWindow window = new PopupWindow(v, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, true);
        window.setWidth(popupWidth);
        window.setOutsideTouchable(true);
        window.setTouchable(true);
        window.setFocusable(true);
        window.setBackgroundDrawable(new BitmapDrawable());

        //Initialize your view here.
        TextView TextView1 = (TextView) v.findViewById(R.id.textview1);
        TextView TextView2 = (TextView) v.findViewById(R.id.textview2);
        LinearLayout Layout = (LinearLayout) v.findViewById(R.id.linearlayout2);
        View dividerView = v.findViewById(R.id.view_divider);

       //Click listeners of your views
        TextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               //your code here

                //to dismiss window
                window.dismiss();
            }
        });

        TextView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //code 
            }
        });
        window.showAtLocation(imagebuttonPopUP, Gravity.NO_GRAVITY, p.x + OFFSET_X - popupWidth, p.y + OFFSET_Y);

    } catch (Exception ex) {
        Logger.e(TAG, ex.getMessage());
    }
}
shalini
  • 355
  • 4
  • 17
0

Yes, you can create Custom Dialog with two translate animation from bottom. Check droid kid answer he is already done in your way. Answer

Community
  • 1
  • 1
Rahul Mandaliya
  • 738
  • 1
  • 12
  • 36
  • it just display anim look likes softkeyboard, not make the main view is above the popup. – R Besar Sep 02 '16 at 05:41
  • Above information is for Dialog not for Views inside layout, you have to check this for Internal Views http://stackoverflow.com/a/9253297/829034 – Rahul Mandaliya Sep 02 '16 at 05:55