Android自定义Dialog----CoolDialog
2018-02-08 本文已影响194人
宛丘之上兮
最近完成了一个开源项目:CoolDialog,github代码地址,代码很少,只有两个kotlin类:CoolDialog.kt
和CoolStyle.kt
。
CoolDialog能够满足大部分样式需求,包括:
- 自定义背景
withBgAndTopbg
- 自定义头部背景
withBgAndTopbg
- 自定义标题和icon
withTitle
、withIcon
- 自定义“取消”和“确定”按钮
withNegativeBtn
、withPositiveBtn
- 自定义对话框内容
withMsg
、withMsgSub
、withContentCustom
- 自定义对话框动画
withCustomAnim
,库中提供的动画参考了这个项目 - 自定义Gravity和左上右下的边距
show(gravity: Int = Gravity.CENTER, paddingLeft: Int = mPadding, paddingTop: Int = mPadding, paddingRight: Int = mPadding, paddingBottom: Int = mPadding)


使用
maven:
<dependency>
<groupId>com.zzh.cooldialog</groupId>
<artifactId>cooldialog</artifactId>
<version>1.0.0</version>
<type>pom</type>
</dependency>
gradle:
compile 'com.zzh.cooldialog:cooldialog:1.0.0'
Ivy:
<dependency org='com.zzh.cooldialog' name='cooldialog' rev='1.0.0'>
<artifact name='cooldialog' ext='pom' ></artifact>
</dependency>