当PopupWindow接近屏幕底部时,它的填充正常,但被截断。 有人知道我如何在弹出窗口靠近屏幕底部时使其向上填充吗?
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);
}
有人知道为什么吗?
setContentView(view);
之前? - DIRTY DAVEsetContentView(view);
之前做了,但仍然不起作用。我在模拟器上测试过了。你能否完整地分享你的代码? - Mir Milad Hosseinyview.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
对我来说也不起作用,但是int spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); view.measure(spec, spec);
却很好用。 - Mir Milad Hosseiny