喂,

我有这个弹出窗口:

    // 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);


如您所见,popup.setHeight(ListPopupWindow.WRAP_CONTENT);设置为包装内容。

但是,如果尺寸小于100px,我想将弹出窗口扩大到600px。

我怎样才能做到这一点?

谢谢 :-)

最佳答案

简单地写...

 popup.setHeight(600);

10-07 13:28