自定义dialog实现窗口四个直角变为弧形
发布日期:2021-11-12 07:57:40 浏览次数:28 分类:技术文章

本文共 785 字,大约阅读时间需要 2 分钟。

原文地址:http://blog.csdn.net/zengchao2013/article/details/50722627

首先,在自定义dialog的布局文件中添加:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/confirm_dialog_bg"
    android:orientation="vertical" >

</LinearLayout>

添加以下confirm_dialog_bg.xml:

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <corners android:radius="10dp" />
<solid android:color="@color/white" />
</shape>

最后把dialog new出来后

FilterDialog dialog = new FilterDialog(this);

dialog.getWindow().setBackgroundDrawableResource(R.color.photo_pick_transparent);

在color中添加全透明属性

<color name="photo_pick_transparent">#00000000</color>

你会惊喜的发现,dialog的四角变得弧形了!

转载地址:https://blog.csdn.net/happy_love1990/article/details/78318021 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Android动态改变ListView的高度
下一篇:简易音乐播放器,带seekBar,可滑动调节播放进度

发表评论

最新留言

很好
[***.229.124.182]2024年04月03日 23时52分02秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章