Open XiongKe94 opened 6 years ago
我做的是一个换肤效果
我看你这个方法的源码是在drawlayout中添加了一个view,但是我如过住界面是一个recycleview的话滑动就会这样。
我如果
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.activity.MainActivity"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar_status_bar" />
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/toolbar_normal" />
<FrameLayout
android:id="@+id/frame_control"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.xk.gvido.app.widget.theme.ColorBottomNavigationView
android:id="@+id/bottom_navigation_view"
android:layout_width="match_parent"
android:layout_height="@dimen/size_56"
android:layout_gravity="bottom"
android:background="@drawable/bottom_bg"
app:itemIconTint="@color/selector_nav_menu_color"
app:itemTextColor="@color/selector_nav_menu_color"
app:layout_behavior="@string/behavior_bottom_navigation"
app:menu="@menu/navigation_tabs" />
</android.support.design.widget.CoordinatorLayout>
</LinearLayout>
加上
<include layout="@layout/toolbar_status_bar" />
(就是一个view)
折磨写的话就没问题,但是其他那些属性那些我就得自己写了
StatusBarUtil.setColorForDrawerLayout(this, drawerLayout, ColorUtils.getThemeColor(this, R.attr.colorPrimaryDark),0); 进来第一次设置时,能够修改是好的,然后,我点击了一个按钮,触发修改状态栏颜色,就是不变。