android 对话框移动,MaterialStyledDialogs - 基于Material带头部的Android对话框_Android_移动开发...

MaterialStyledDialogs是一个Android库,它允许开发者创建具有Material Design风格且可高度定制的对话框。这个库基于material-dialogs,并受到了dribbble设计的启发。通过在项目中引入特定的依赖,可以轻松地展示带有标题、描述、图标和自定义颜色的对话框。此外,还可以设置对话框的动画效果、取消功能、滚动描述以及正、负、中性按钮。已有多款应用采用了此库。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MaterialStyledDialogs - 一个Android库用于创建一个漂亮和可定制基于Material带头部的对话框。基于 material-dialogs 并且受到 dribbble 启发

10615625.png

How to include

Add the repository to your project build.gradle:

repositories {

maven {

url "https://jitpack.io"

}

}

And add the library to your module build.gradle:

dependencies {

compile 'com.github.javiersantos:MaterialStyledDialogs:1.2'

}

Usage

Basic Dialog

A basic dialog will show the provided title (optional) and description, using your primary color as the header background.

new MaterialStyledDialog(this)

.setTitle("Awesome!")

.setDescription("What can we improve? Your feedback is always welcome.")

.show();

or using the builder...

MaterialStyledDialog dialog = new MaterialStyledDialog(this)

.setTitle("Awesome!")

.setDescription("What can we improve? Your feedback is always welcome.")

.build();

...

dialog.show();

Customization

// Set an icon for the dialog header.

.setIcon(R.drawable.ic_launcher)

// Set if the header icon will be displayed with an initial animation.

// Default: true

.withIconAnimation(false)

// Set if the dialog will be displayed with an open and close animation, with custom duration.

// Default: false

.withDialogAnimation(true)

// Default: false, Duration.NORMAL

.withDialogAnimation(true, Duration.SLOW)

// Set a color for the dialog header.

// Default: Theme primary color.

.setHeaderColor(R.color.dialog_header)

// Set an image for the dialog header.

// API 16+ required.

.setHeaderDrawable(R.drawable.header)

// Set if the dialog will be hidden when touching outside.

// Default: true

.setCancelable(false)

// Set if the description will be scrollable, with custom maximum lines.

// Default: false

.setScrollable(true)

// Default: false, 5

.setScrollable(true, 10)

// Set a positive, negative and/or neutral button for the dialog.

.setPositive(getResources().getString(R.string.button), new MaterialDialog.SingleButtonCallback() {

@Override

public void onClick(MaterialDialog dialog, DialogAction which) {

Log.d("MaterialStyledDialogs", "Do something!");

}

})

//.setNegative(...)

//.setNeutral(...)

Apps already using this library

10615626.png

项目地址:

https://github.com/javiersantos/MaterialStyledDialogs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值