final PopupWindow pw=new PopupWindow(v, ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT,true); pw.setTouchable(true); pw.setTouchInterceptor(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { return false; } }); View view2= LayoutInflater.from(this).inflate(R.layout.commom_layout,null); view2.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); pw.setContentView(view2); EditText et= (EditText) view2.findViewById(R.id.content); Button send= (Button) view2.findViewById(R.id.send); send.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (pw.isShowing()){ pw.dismiss(); } } }); et.setFocusable(true); pw.setBackgroundDrawable(getResources().getDrawable(R.color.colorAccent)); pw.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED); pw.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); pw.showAtLocation(v, Gravity.BOTTOM,0,0);