I am using a custom popup window. On Load I have to pass the height and width of the window. But I want to load the popup for all screensizes. I am using the below function to load my popup.
private void loadPopup() {
LayoutInflater inflater = this.getLayoutInflater();
final View layout = inflater.inflate(R.layout.activity_pop_up_ad, null);
final PopupWindow windows = new PopupWindow(layout , 300,500,true);
layout.post(new Runnable() {
public void run() {
windows.showAtLocation(layout,Gravity.CENTER, 0, 0);
}
});
ImageButton close = (ImageButton) layout.findViewById(R.id.close);
close.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
windows.dismiss();
}
});
}
I tried this one. But it completes the screen size. I don't want that much filled.
windows.setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
Any ideas?