Android开发Android开发经验谈程序员

Android自定义Dialog----CoolDialog

2018-02-08  本文已影响194人  宛丘之上兮

最近完成了一个开源项目:CoolDialog,github代码地址,代码很少,只有两个kotlin类:CoolDialog.ktCoolStyle.kt

CoolDialog能够满足大部分样式需求,包括:

  1. 自定义背景withBgAndTopbg
  2. 自定义头部背景withBgAndTopbg
  3. 自定义标题和icon withTitlewithIcon
  4. 自定义“取消”和“确定”按钮withNegativeBtnwithPositiveBtn
  5. 自定义对话框内容withMsgwithMsgSubwithContentCustom
  6. 自定义对话框动画withCustomAnim,库中提供的动画参考了这个项目
  7. 自定义Gravity和左上右下的边距show(gravity: Int = Gravity.CENTER, paddingLeft: Int = mPadding, paddingTop: Int = mPadding, paddingRight: Int = mPadding, paddingBottom: Int = mPadding)
图1 cooldialogAnim.gif

使用

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>
上一篇 下一篇

猜你喜欢

热点阅读