github:https://github.com/orhanobut/dialogplus
github原图:  
  
demo效果图:  
  
总有3个Holder:ViewHolder、ListHolder、GridHolder,其中ViewHolder是用于自定义视图,ListHolder用于ListView,GridHolder用于GridView。
| 方法 | 说明 | 
|---|---|
| newDialog(Context context) | 创建dialog | 
| setContentHolder(Holder holder) | 设置holder,必要 | 
| setContentWidth(int width) | 宽:ViewGroup.LayoutParams.WRAP_CONTENT等 | 
| setContentHeight(int height) | 高 | 
| setHeader(int resourceId) | 头的布局或View | 
| setFooter(int resourceId) | 尾的布局或View | 
| setGravity(int gravity) | dialog的位置 | 
| setExpanded(boolean expanded) | 是否可扩展,默认是false,仅适用于ListView和GridView | 
| setCancelable(boolean isCancelable) | 点击外部区域是否可以取消dialog | 
| setAdapter(BaseAdapter adapter) | ListView或GridView的adapter,ViewHolder不需要 | 
| setOnItemClickListener(OnItemClickListener listener) | ListView或GridView的item的点击事件 | 
| setOnClickListener(OnClickListener listener) | 点击事件 | 
| setOnDismissListener(OnDismissListener listener) | dismiss的监听 | 
| setOnCancelListener(OnCancelListener listener) | 取消的监听 | 
| getHolderView() | 获取视图View | 
| getHeaderView() | 获取头布局 | 
| getFooterView() | 获取尾布局 | 
| setMargin(left, top, right, bottom) | Add margins to your dialog. They are set to 0 except when gravity is center. In that case basic margins are applied | 
| setPadding(left, top, right, bottom) | Set padding to the holder | 
| setInAnimation(R.anim.abc_fade_in) | 进入动画 | 
| setOutAnimation(R.anim.abc_fade_out) | 移除动画 | 
| setContentBackgroundResource(resource) | dialog的背景色 | 
| setOverlayBackgroundResource(resource) | dialog意外的背景色 | 
https://git.oschina.net/libraryDemo/DialogPlus01
github地址:https://github.com/pedant/sweet-alert-dialog

注意:直接这样添加依赖会报错: 
解决方法:
在AndroidManifest.xml中添加xmlns:tools="http://schemas.android.com/tools"tools:replace="android:icon"






点击确认后切换到对话框样式:
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { @Override public void onClick(SweetAlertDialog sDialog) { sDialog .setTitleText("Deleted!") .setContentText("Your imaginary file has been deleted!") .setConfirmText("OK") .setConfirmClickListener(null) .changeAlertType(SweetAlertDialog.SUCCESS_TYPE); }})https://git.oschina.net/libraryDemo/SweetAlertDialog01
新闻热点
疑难解答