DIR*_*AVE 4 android android-popupwindow
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);
}
Run Code Online (Sandbox Code Playgroud)
有人知道为什么吗?
测量视图然后设置高度解决了我的问题。
View view = LayoutInflater.from(mContext).inflate(R.layout.popupmenu_addphotos, null);
Run Code Online (Sandbox Code Playgroud)
view.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
setHeight(view.getMeasuredHeight());
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1760 次 |
| 最近记录: |