提交 ae8a820a 编写于 作者: J jessyan

customeListener improve

上级 349322fc
......@@ -18,6 +18,7 @@ public class CustomPopupWindow extends PopupWindow {
private boolean isFocus;
private Drawable mBackgroundDrawable;
private int mAnimationStyle;
private boolean isWrap;
private CustomPopupWindow(Builder builder) {
this.mContentView = builder.contentView;
......@@ -27,6 +28,7 @@ public class CustomPopupWindow extends PopupWindow {
this.isFocus = builder.isFocus;
this.mBackgroundDrawable = builder.backgroundDrawable;
this.mAnimationStyle = builder.animationStyle;
this.isWrap = builder.isWrap;
initLayout();
}
......@@ -36,8 +38,8 @@ public class CustomPopupWindow extends PopupWindow {
private void initLayout() {
mListener.initPopupView(mContentView);
setWidth(LayoutParams.MATCH_PARENT);
setHeight(LayoutParams.MATCH_PARENT);
setWidth(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
setHeight(isWrap ? LayoutParams.WRAP_CONTENT : LayoutParams.MATCH_PARENT);
setFocusable(isFocus);
setOutsideTouchable(isOutsideTouch);
setBackgroundDrawable(mBackgroundDrawable);
......@@ -83,6 +85,7 @@ public class CustomPopupWindow extends PopupWindow {
private boolean isFocus = true;//默认为true
private Drawable backgroundDrawable = new ColorDrawable(0x00000000);//默认为透明
private int animationStyle = -1;
private boolean isWrap;
private Builder() {
}
......@@ -97,6 +100,12 @@ public class CustomPopupWindow extends PopupWindow {
return this;
}
public Builder isWrap(boolean isWrap) {
this.isWrap = isWrap;
return this;
}
public Builder customListener(CustomPopupWindowListener listener) {
this.listener = listener;
return this;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册