本文基于 android_13.0.0_r1 讲解
布局文件 status_bar_expanded.xml 中的 NotificationStackScrollLayout 是显示和滚动通知列表的布局。直接修改其 android:background 属性就可以修改通知列表的背景颜色。
...
<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">
...
<com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="@integer/notification_panel_layout_gravity"
android:id="@+id/notification_container_parent"
android:clipToPadding="false"
android:clipChildren="false">
...
<com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout
android:id="@+id/notification_stack_scroller"
android:layout_marginTop="@dimen/notification_panel_margin_top"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginHorizontal="@dimen/notification_panel_margin_horizontal"
android:layout_marginBottom="@dimen/notification_panel_margin_bottom"
android:importantForAccessibility="no"
systemui:layout_constraintStart_toStartOf="parent"
systemui:layout_constraintEnd_toEndOf="parent"
/>
...
</com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer>
...
</com.android.systemui.statusbar.phone.NotificationPanelView>
NotificationsQuickSettingsContainer 是整个下拉状态栏的一层父布局,可以用它设置整个下拉状态栏的布局背景颜色。
通过上述对 NotificationStackScrollLayout 的属性设置 android:background,通知栏整体背景颜色已经如预期更改了颜色,但发现还有通知栏的下面椭圆区域还是没有改变。这个后续再查看...