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