Android8.1 SystemUI 下拉通知栏添加高斯模糊

Android8.1 SystemUI 下拉通知栏添加高斯模糊

这个功能以前在6.0上做过,现在移植到8.1;顺便写个博客记录下,有不好的地方,还请各位大神不吝赐教

1:把qspanel的背景去掉

res/layout/qs_panel.xml

<com.android.systemui.qs.QSContainerImpl
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/quick_settings_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    //删除 begin
    android:background="@drawable/qs_background_primary"
    android:elevation="4dp"
   //删除 end
    android:clipToPadding="false"
    android:clipChildren="false">

    <com.android.systemui.qs.QSPanel
        android:id="@+id/quick_settings_panel"
        android:layout_marginTop="28dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="48dp" />

    <include layout="@layout/quick_status_bar_expanded_header" />

    <include layout="@layout/qs_footer_impl" />

    <include android:id="@+id/qs_detail" layout="@layout/qs_detail" />

    <include android:id="@+id/qs_customize" layout="@layout/qs_customize_panel"
        android:visibility="gone" />

</com.android.systemui.qs.QSContainerImpl>

我这里顺便把投影也干掉了。

2:添加一个ImageView,放高斯模糊的图片

我这里还添加了一个半透明的view,因为只有一个高斯模糊会很难看
res/layout/status_bar_expanded.xml :

<com.android.systemui.statusbar.phone.NotificationPanelView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:systemui="http://schemas.android.com/apk/res-auto"
    android:id="@+id/notification_panel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent" >

    <!-- 添加 begin -->
    <ImageView
            android:id="@+id/blur_view"
            android:alpha="0"
            android:layout_width="match_parent"
            android:scaleTyp
  • 3
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值