How to get height of Popup after it is set to wrap_content?

Viewed 966

Helo,

I've got this popup:

    // Inflate the popup_layout.xml
    LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.popup);
    LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View layout = layoutInflater.inflate(R.layout.day_popup_date, viewGroup);

    layout.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
            View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));

    int popupWidth = width;
    final int popupHeight = height;

    // Creating the PopupWindow
    final PopupWindow popup = new PopupWindow(context);

    popup.setContentView(layout);
    popup.setWidth(popupWidth);
    popup.setHeight(ListPopupWindow.WRAP_CONTENT);
    popup.setFocusable(false);

As you see, popup.setHeight(ListPopupWindow.WRAP_CONTENT); is set to wrap content.

But I want enlarge the popup to 600px if the size is smaller than 100px.

How can I do that?

Thanks :-)

2 Answers
Related