AlertDialog制作圆角 背景有直角问题
2017-07-19 15:50
2947 查看
问题:一般在使用弹窗的时候,为了美观都会设计成圆角边框,但是圆角边框的同时会出现白色直角部分。
下面是一个AlertDialog ,特别注意红色的部分,加上红色的这两行,就是将弹窗的背景设置为透明色(#00000000)
设置圆角的xml
下面是一个AlertDialog ,特别注意红色的部分,加上红色的这两行,就是将弹窗的背景设置为透明色(#00000000)
AlertDialog dialog; private void showConfirm() { AlertDialog.Builder builder=new AlertDialog.Builder(context); View view=LayoutInflater.from(context).inflate(R.layout.dialog_pay_confirm,null); TextView confirm= (TextView) view.findViewById(R.id.tv_pay_confirm); builder.setView(view); dialog = builder.create(); Window window=dialog.getWindow(); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); }
设置圆角的xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="15dp"/> <stroke android:width="2dp" android:color="@color/colorPrimary" /> <!-- 填充颜色 --> <solid android:color="#ffffffff" /> </shape>
相关文章推荐
- AlertDialog自定义界面圆角有背景问题
- AlertDialog自定义样式显示圆角背景失败
- 解决圆角dialog黑色(白色)背景问题
- Android修改AlertDialog宽和高以及设置AlertDialog的背景
- 关于SweetAlertDialog在Android Studio中遇到问题
- 圆角导航菜单制作(图片作为背景)
- Android Dialog圆角问题
- 关于JKAlertDialog在多个视图控制器跳转后不能正常显示的问题的解决--IOS
- css代码制作圆角边黑灰斜纹背景导航条
- android alertdialog设置圆角
- 关于安卓alertdialog你能用到的都在这里了(进出动画,显示位置,背景,设置内容,是否可以点击其他地方消失,屏幕不变暗)
- AlertDialog使用时遇到问题
- AlertDialog单选列表对话框焦点获取问题
- Android 以Dialog的方式显示Activity,并且处理背景四个角为圆角,去掉黑角
- 关于Android中AlertDialog的使用问题:点击AlertDialog外部不消失的代码操作
- 安卓开发 自定义Dialog的问题总结之---Title背景为黑问题、edittext无法弹出软键盘
- 锤子手机使用AlertDialog.Builder出现白屏、闪屏问题
- AlertDialog.setMessage不显示的问题
- AlertDialog无法弹出软键盘问题
- AlertDialog自定义内容区时宽高问题