android自动以居中弹出框,GitHub - EthanCo/TangramDialog: Android 对话框,基于DialogFragment,可自定义布局及动画,可指定弹出位置(顶部、居中...

/**

* 设置标题

*

* @param title

* @return

*/

public Builder title(CharSequence title)

/**

* 设置标题

*

* @param titleRes

* @return

*/

public Builder title(@StringRes int titleRes)

/**

* 设置标题TextStyle

*

* @param style Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC

* @return

*/

public Builder titleTextStyle(int style)

/**

* 标题颜色

*

* @param colorRes

* @return

*/

public Builder titleColorRes(@ColorRes int colorRes)

/**

* 标题字体大小

*

* @param textSize

* @return

*/

public Builder titleTextSize(float textSize) {

this.titleTextSize = textSize;

return this;

}

/**

* 内容文字

*

* @param content

* @return

*/

public Builder content(CharSequence content) {

this.content = content;

return this;

}

/**

* 内容文字

*

* @param contentRes

* @return

*/

public Builder content(@StringRes int contentRes) {

this.content = context.getString(contentRes);

return this;

}

/**

* 内容文字TextStyle

*

* @param style Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC

* @return

*/

public Builder contentTextStyle(int style)

/**

* 内容文字对齐方式

*

* @param gravity

* @return

*/

public Builder contentTextGraviry(int gravity)

/**

* 内容文字颜色

*

* @param colorRes

* @return

*/

public Builder contentColorRes(@ColorRes int colorRes)

/**

* 内容文字字体

*

* @param textSize

* @return

*/

public Builder contentTextSize(float textSize)

/**

* 次要内容文字

*

* @return

*/

public Builder tips(CharSequence content)

/**

* 次要内容文字

*

* @param contentRes

* @return

*/

public Builder tips(@StringRes int contentRes)

/**

* 次要内容TextStyle

*

* @param style Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC

* @return

*/

public Builder tipsTextStyle(int style)

/**

* 次要内容文字颜色

*

* @param colorRes

* @return

*/

public Builder tipsColorRes(@ColorRes int colorRes)

/**

* 次要内容文字字体

*

* @param textSize

* @return

*/

public Builder tipsTextSize(float textSize)

/**

* 图片资源ID

*

* @param imgRes

* @return

*/

public Builder imgRes(@DrawableRes int imgRes)

/**

* 对话框布局,用作替换默认布局样式,id需要和默认布局保持一致

*

* @param layoutId

* @return

*/

public Builder layoutId(int layoutId)

/**

* 否定的按钮文字

*

* @param message

* @return

*/

public Builder negativeText(CharSequence message)

/**

* 否定的按钮文字

*

* @param messageRes

* @return

*/

public Builder negativeText(@StringRes int messageRes)

/**

* 否定的按钮字体大小

*

* @param textSize

* @return

*/

public Builder negativeTextSize(int textSize)

/**

* 否定的按钮文字TextStyle

*

* @param style Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC

* @return

*/

public Builder negativeTextStyle(int style)

/**

* 否定的按钮文字颜色

*

* @param textColor

* @return

*/

public Builder negativeTextColor(@ColorRes int textColor)

/**

* 中立的按钮文字

*

* @param message

* @return

*/

public Builder neutralText(CharSequence message)

/**

* 中立的按钮文字

*

* @param messageRes

* @return

*/

public Builder neutralText(@StringRes int messageRes)

/**

* 中立的按钮字体大小

*

* @param textSize

* @return

*/

public Builder neutralTextSize(int textSize)

/**

* 中立的按钮文字TextStyle

*

* @param style Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC

* @return

*/

public Builder neutralTextStyle(int style)

/**

* 中立的按钮文字颜色

*

* @param textColor

* @return

*/

public Builder neutralTextColor(@ColorRes int textColor)

/**

* 肯定的按钮文字

*

* @param message

* @return

*/

public Builder positiveText(CharSequence message)

/**

* 肯定的按钮文字

*

* @param messageRes

* @return

*/

public Builder positiveText(@StringRes int messageRes)

/**

* 肯定的按钮字体大小

*

* @param textSize

* @return

*/

public Builder positiveTextSize(int textSize)

/**

* 肯定的按钮文字

*

* @param style Typeface.NORMAL, Typeface.BOLD, Typeface.ITALIC, Typeface.BOLD_ITALIC

* @return

*/

public Builder positiveTextStyle(int style)

/**

* 肯定的按钮文字颜色

*

* @param textColor

* @return

*/

public Builder positiveTextColor(@ColorRes int textColor)

/**

* 对话框位置

*

* @param gravity {@link android.view.Gravity#TOP}:顶部

* {@link android.view.Gravity#CENTER}:居中

* {@link android.view.Gravity#BOTTOM}:底部

* @return

*/

public Builder gravity(int gravity)

/**

* 对话框 显示/隐藏 动画

*

* @param animStyle

* @return

*/

public Builder animStyle(int animStyle)

/**

* 指定对话框宽度

*

* @param width

* @return

*/

public Builder width(int width)

/**

* 指定对话框高度

*

* @param height

* @return

*/

public Builder height(int height)

/**

* 肯定的按钮 点击回调

*

* @param callback

* @return

*/

public Builder onPositive(@NonNull ButtonCallback callback)

/**

* 中立的按钮 点击回调

*

* @param callback

* @return

*/

public Builder onNeutral(@NonNull ButtonCallback callback)

/**

* 否定的按钮 点击回调

*

* @param callback

* @return

*/

public Builder onNegative(@NonNull ButtonCallback callback)

/**

* 对话框外围 点击是否可隐藏

*

* @param canceledOnTouchOutside

* @return

*/

public Builder canceledOnTouchOutside(boolean canceledOnTouchOutside)

/**

* 对话框 margin - 需要结合background有效

*

* @param margin

* @return

*/

public Builder margin(int margin)

/**

* 背景的昏暗度

*

* @param dimAmount

* @return

*/

public Builder dimAmount(@FloatRange(from = 0, to = 1) float dimAmount)

/**

* 设置背景

* 例如 new ColorDrawable(Color.BLUE) //蓝色

* new ColorDrawable(Color.TRANSPARENT) //透明

*

* @param drawable

* @return

*/

public Builder background(Drawable drawable)

/**

* 设置背景色

*

* @param backgroundColor

* @return

*/

public Builder backgroundColor(@ColorRes int backgroundColor)

/**

* 设置自定义的View

* 通过{@link DialogBase#getRootView()}获取根View

*

* @param customView

* @return

*/

public Builder customView(View customView)

/**

* 设置自定义的View

* 通过{@link DialogBase#getRootView()}获取根View

*

* @param layoutRes

* @return

*/

public Builder customView(@LayoutRes int layoutRes)

/**

* 点击按钮是否自动隐藏对话框

*

* @param dismiss

* @return

*/

public Builder autoDismiss(boolean dismiss)

/**

* 对话框相对自身位置X轴的偏移量

*

* @param offsetX

* @return

*/

public Builder offsetX(int offsetX)

/**

* 对话框相对自身位置Y轴的偏移量

*

* @param offsetY

* @return

*/

public Builder offsetY(int offsetY)

/**

* 点击背景 点击事件是否穿透

*

* @param canPenetrate

* @return

*/

public Builder canPenetrate(boolean canPenetrate)

/**

* 显示输入框

*

* @param hint hint文字

* @param prefill 预加载的文字

* @param callback 输入改变回调

* @return

*/

public Builder input(

@Nullable CharSequence hint,

@Nullable CharSequence prefill,

@NonNull InputCallback callback)

/**

* 显示输入框

*

* @param hint hint文字

* @param prefill 预加载的文字

* @param allowEmptyInput 是否允许为空

* @param callback 输入改变回调

* @return

*/

public Builder input(

@Nullable CharSequence hint,

@Nullable CharSequence prefill,

boolean allowEmptyInput,

@NonNull InputCallback callback)

/**

* 显示输入框

*

* @param hint hint文字

* @param prefill 预加载的文字

* @param allowEmptyInput 是否允许为空

* @param callback 输入改变回调

* @return

*/

public Builder input(

@StringRes int hint,

@StringRes int prefill,

boolean allowEmptyInput,

@NonNull InputCallback callback)

/**

* 显示输入框

*

* @param hint hint文字

* @param prefill 预加载的文字

* @param callback 输入改变回调

* @return

*/

public Builder input(

@StringRes int hint, @StringRes int prefill, @NonNull InputCallback callback)

/**

* 内部Padding

*

* @param padding 单位为DP

* @return

*/

public Builder padding(int padding)

/**

* 内部Padding

*

* @param paddingLeft 单位为DP

* @param paddingTop 单位为DP

* @param paddingRight 单位为DP

* @param paddingBottom 单位为DP

* @return

*/

public Builder padding(int paddingLeft, int paddingTop, int paddingRight, int paddingBottom)

/**

* 顶部横条是否可见

*

* @param visibility

* @return

*/

public Builder topBarVisibility(int visibility)

/**

* 关闭按钮是否可见

*

* @param visibility

* @return

*/

public Builder imgCloseVisibility(int visibility)

/**

* 当点击关闭按钮

*

* @param callback

* @return

*/

public Builder onImgClose(ButtonCallback callback)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值