Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PopupWindow being cutoff towards bottom of screen

PopupWindow inflates fine until it is near bottom of screen it's being cut off. Anyone know how I can it inflate upwards when it's towards bottom of screen?

enter image description here

public SelectBucketMenu(Context context) {
        super(context);
        this.mContext = context;

        setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        setOutsideTouchable(true);
        setFocusable(true);
        //Need set windowlayout for API 19 otherwise window won't appear
        setWindowLayoutMode(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

        setupView();
    }

    private void setupView(){
        View view = LayoutInflater.from(mContext)
                .inflate(R.layout.popupmenu_selectbucket, null);
        ButterKnife.bind(this, view);
        setContentView(view);
    }

Anyone know why?

like image 584
DIRTY DAVE Avatar asked Oct 23 '25 11:10

DIRTY DAVE


1 Answers

Measuring the view and then setting the height fixed my issue.

View view = LayoutInflater.from(mContext).inflate(R.layout.popupmenu_addphotos, null);
view.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
setHeight(view.getMeasuredHeight());
like image 61
DIRTY DAVE Avatar answered Oct 26 '25 01:10

DIRTY DAVE