Try this::
You need to create layout that you want to show in popup. you can create layout XML and use it like this:
LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(R.layout.new_popup_layout, null);
final PopupWindow popupWindow = new PopupWindow(
layout,
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
You can also provide click events of button like this:
ImageButton btnChoose = (ImageButton) layout.findViewById(R.id.btnChoose);
btnChoose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
}
});
and show this popup like this: here you want to show this on button click then button view will be there.
popupWindow.showAtLocation(anyview,Gravity.CENTER, 0, 0);