yilylong / cbdialog Goto Github PK
View Code? Open in Web Editor NEW一个快速创建对话框的工具类库
一个快速创建对话框的工具类库
当Dialog被创建之后在别的地方无法更新他的内容。
当他是一个要接收持续状态的Dialog的时候尤为重要
暂时的解决方案:如下先找到控件
TextView dialogMsg = (TextView) dialog.findViewById(com.zhl.cbdialog.R.id.dialog_message);//eg
Button confrimBtn = (Button) dialog.findViewById(com.zhl.cbdialog.R.id.dialog_posi_btn);//eg
//重新设置值
dialogMsg.setText("正在获取服务器数据库更新..."); //eg
dialogMsg.setText("正在解析..."); //eg
但是我不认为这是一个好的解决方案,如果作者有时间精力,希望能提供解决方案(例如:不使用Dialog作为返回值,而是CBDialog)
期待您的回复:)
请问下 那个进度条默认10秒不能更改 时间太久了呀 想做到点击按钮就开始加载进度条 数据来了就关闭进度条
您好 我想问一下 为什么有些手机上显示不出对话框来?
官方Dialog Guide都是直接从FragmentDialog
,` [可以保存dialog的数据,生命周期便于管理。而这个库直接使用Dialog来管理,有考虑前面的问题吗?
new CBDialogBuilder(this)
.setTouchOutSideCancelable(true)
.showCancelButton(true)
.setTitle("这是一个普通样式的对话框")
.setMessage("this is a normal CBDialog")
.setConfirmButtonText("确定")
.setCancelButtonText("取消")
.setConfirmButtonTextColor(Color.YELLOW)
.setDialogAnimation(CBDialogBuilder.DIALOG_ANIM_SLID_BOTTOM)
.create().show();
这个不会显示黄色还是蓝色,我移植时发现这个问题,大概看了源码也没有问题。
public CBDialogBuilder setConfirmButtonTextColor(int color) {
if(this.confrimBtn != null) {
this.confrimBtn.setTextColor(color);
}
return this;
}
会不会是null检查这里过不去?
如果不设置标题,仍然会显示一个默认的标题,这样不是强制要求必须显示标题了?
在类:CBDialogBuilder 中的方法:
public CBDialogBuilder(Context context, int layoutStyle,
boolean isSystemAlert, float widthcoefficient, float alpha) {
.....
// 设置透明
WindowManager.LayoutParams lp = window.getAttributes();
if (alpha > 0) {
lp.alpha = 1.0f;
} else {
lp.alpha = ALPHAFACTOR;
}
....
}
alpha 大于 零的时候,alpha 设置成 1.0 ,而 else,alpha = ALPHAFACTOR = 1.0 !
....
建议改成:
if (alpha > 1.0f || alpha <0) {
lp.alpha = 1.0f;
} else {
lp.alpha = alpha;
}
message字数太多,展示不全
没有找到dismiss或者close的方法
自定义布局中设置.showCancelButton(true)不起作用
只显示ConfirmButton
而且监听也不起作用,下载demo修改如下也是不行
` case R.id.custom_dialog_layout:
new CBDialogBuilder(this, R.layout.layout_custom_dialog_layout, 1.0f)
.setTouchOutSideCancelable(true)
.showCancelButton(true)
.setCancelButtonText("取消")
.setDialoglocation(CBDialogBuilder.DIALOG_LOCATION_BOTTOM)
.setTitle("这是一个自定义dialog布局样式的对话框")
.setMessage("去除了dialog的圆角背景")
.setConfirmButtonText("确定")
.setDialogAnimation(CBDialogBuilder.DIALOG_ANIM_SLID_BOTTOM)
.setButtonClickListener(true, new CBDialogBuilder.onDialogbtnClickListener() {
@OverRide
public void onDialogbtnClick(Context context, Dialog dialog, int whichBtn) {
Toast.makeText(context, "点击了确定", Toast.LENGTH_SHORT).show();
}
})
.create().show();
break;`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.