Android-CircleDialog - 仿 iOS 圆角对话框


Apache
跨平台
Java

软件简介

相比SuperDialog而言,此库支持横竖屏切换 基于DialogFragment封装,支持自定义边框圆角、背景透明度、字体大小与色值等。
列表选择框可以接收ListArrays的数据源,详细见demo
初衷是掌握知识点,此库不一定适合你的产品整体风格,当然能够适合你的项目最好不过,有建议和不足之处欢迎骚扰。

知识点

全代码创建shapeselectorLayout,三大Layout不用多讲,肯定都会的,主要是Drawable所使用类如下:

  • ShapeDrawableRoundRectShapeGradientDrawableClipDrawableLayerDrawableStateListDrawable

效果图

引入

 compile 'com.mylhyl:circleDialog:2.0.0'

eclipse 可以点击这里下载aar文件,
然后用zip解压取出jar包

使用

简单的对话框

new CircleDialog.Builder(this)
                        .setTitle("标题")
                        .setText("提示框")
                        .setPositive("确定", null)
                        .show();

选择对话框

final String[] items = {"拍照", "从相册选择", "小视频"};
                new CircleDialog.Builder(this)
                        .configDialog(new ConfigDialog() {
                            @Override
                            public void onConfig(DialogParams params) {
                                //增加弹出动画
                                params.animStyle = R.style.dialogWindowAnim;
                            }
                        })
                        .setTitle("标题")
                        .setTitleColor(Color.BLUE)
                        .setItems(items, new AdapterView.OnItemClickListener() {
                            @Override
                            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                            }
                        })
                        .setNegative("取消", null)
                        .configNegative(new ConfigButton() {
                            @Override
                            public void onConfig(ButtonParams params) {
                                //取消按钮字体颜色
                                params.textColor = Color.RED;
                            }
                        })
                        .show();

[更多具体参数]