gpt4 book ai didi

android - PopupWindow 被截断到屏幕底部

转载 作者:行者123 更新时间:2023-12-04 23:58:04 27 4
gpt4 key购买 nike

PopupWindow 膨胀得很好,直到它接近屏幕底部,它被切断了。有谁知道当它接近屏幕底部时如何让它向上膨胀?

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

有人知道为什么吗?

最佳答案

测量 View 然后设置高度解决了我的问题。

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

关于android - PopupWindow 被截断到屏幕底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59771672/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com