android仿ios弹出动画,仿ios底部弹出样式的Dialog

SheetDialog , 仿造IOS 风格底部弹出的样式,通用的Dialog

在博客中阅读 体验更佳,更新的说明会在博客中持续更新 点击查看

Overview

ddfcf8d8a3ca49e89403501a05513491.gif

74d6f5e8082cde2ac9988cd81b54d127.gif

Download

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {

repositories {

maven { url 'https://www.jitpack.io' }

}

}

Step 2. Add the dependency

dependencies {

implementation 'com.github.JiangHaiYang01:SheetDialog:0.0.2'

}

当前最新版本

a9441724-6516-4ab9-9209-20d69b0f120a.svg.svg

Usage

仿ios 的底部弹出效果

SheetDialog(this)

.create()

.setTitle("请选择") //title 提示

.setCancelTvColor(Color.RED)//设置cancel 颜色

.setCancelTvMsg("取消") //设置cancel 文案

.setCancelTvSize(16f)//设置cancel 字体大小

.addSheetItem("照片", object : OnSheetItemClickListener() {

override fun onSheetItemClick() {

Toast.makeText(this@MainActivity, "照片", Toast.LENGTH_SHORT).show()

}

})

.addSheetItem("拍照", object : OnSheetItemClickListener() {

override fun onSheetItemClick() {

Toast.makeText(this@MainActivity, "拍照", Toast.LENGTH_SHORT).show()

}

})

.setCancelTvMsg("取消")

.show()

通用的dialog

GeneralDialog(this)

.create()

.setTitle("请输入手机号")

//取消

.setNegative(object : GeneralDialog.OnNegativeListener {

override fun onNegative(dialog: GeneralDialog) {

dialog.dismiss()

}

})

//确认

.setPositive(object : GeneralDialog.OnPositiveListener {

override fun onPositive(dialog: GeneralDialog) {

dialog.dismiss()

Toast.makeText(

applicationContext,

editText.text.toString(),

Toast.LENGTH_SHORT

).show()

}

})

.setGradientRadius(40f)

//自定义的布局

.setCustomView(R.layout.dialog_custom, object : GeneralDialog.OnCustomListener {

override fun onCustom(view: View) {

editText = view.findViewById(R.id.custom_et_phone)

}

})

//添加动画

.setAnimations(R.style.ActionSheetDialogAnimation)

.show()

Github

License

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值