Android6.0 原生SystemUI通知修改圆角

以下内容主要是做笔记为主

修改前:

在这里插入图片描述

修改后:

在这里插入图片描述

1、修改圆角:

frameworks\base\packages\SystemUI\res\values\dimens.xml 文件中notification_material_rounded_rect_radius改为16dp(可以自定)

<!-- radius of the corners of the material rounded rect background -->
<dimen name="notification_material_rounded_rect_radius">16dp</dimen>

修改完后,接着修改长按显示的背景圆角:
frameworks\base\packages\SystemUI\res\drawable\notification_guts_bg.xml 文件,android:radius值改为notification_material_rounded_rect_radius

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/notification_guts_bg_color" />
    <!--The radius is 1dp smaller than the notification one, to avoid aliasing bugs on the corners -->
    <corners android:radius="@dimen/notification_material_rounded_rect_radius" />
</shape>

四角还有灰色背景。
在这里插入图片描述

2、修改通知四周灰色背景圆角:

修改frameworks\base\packages\SystemUI\src\com\android\systemui\statusbar\ExpandableOutlineView.java 文件,outline增加radius

    public ExpandableOutlineView(Context context, AttributeSet attrs) {
        ...
        
        setOutlineProvider(new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                if (!mCustomOutline) {
                	// modify start {
                    /*outline.setRect(0,
                            mClipTopAmount,
                            getWidth(),
                            Math.max(getActualHeight(), mClipTopAmount));*/
                    outline.setRoundRect(0,
                            mClipTopAmount,
                            getWidth(),
                            Math.max(getActualHeight(), mClipTopAmount),
                            mRoundedRectCornerRadius);
                    // modify end }
                } else {
                    outline.setRoundRect(mOutlineRect, mRoundedRectCornerRadius);
                }
                outline.setAlpha(mOutlineAlpha);
            }
        });
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值