Android CoordinatorLayout(AppbarLayout)无法正确绘制工具栏
我正在使用新的设计支持库来实现滚动隐藏工具栏。 然而,如果我不加载毕加索的图像,一切都会很好。若我加载图像,有时当我向下滚动让工具栏再次显示时,我的工具栏会变成一个空白的白色矩形。请注意,在这种情况下,我仍然可以按导航开关打开抽屉,尽管屏幕上没有绘制(显示): 但有时效果很好: 我很困惑,如果我禁用所有加载图像任务,工具栏可以正常显示。 以下是我的布局:Android CoordinatorLayout(AppbarLayout)无法正确绘制工具栏,android,android-toolbar,android-design-library,Android,Android Toolbar,Android Design Library,我正在使用新的设计支持库来实现滚动隐藏工具栏。 然而,如果我不加载毕加索的图像,一切都会很好。若我加载图像,有时当我向下滚动让工具栏再次显示时,我的工具栏会变成一个空白的白色矩形。请注意,在这种情况下,我仍然可以按导航开关打开抽屉,尽管屏幕上没有绘制(显示): 但有时效果很好: 我很困惑,如果我禁用所有加载图像任务,工具栏可以正常显示。 以下是我的布局: <android.support.design.widget.CoordinatorLayout android:layou
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
我认为,当毕加索将图像加载到ImageView中时,它可能会请求聚焦和布局,而CoordinatorLayout在这种情况下无法正确地重新绘制工具栏,但这只是我的猜测
任何建议都会有帮助,非常感谢
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
试试这个。我用这个片段解决了同样的问题。我在工具栏后添加了高度为1dp的虚拟视图 我也面临着同样的问题。我想不出来。任何帮助都将是可观的…看起来它只发生在5.1以下。你能解释这个问题是什么吗?这是一个错误。看到这个WTF谷歌了吗?1年后,该漏洞仍然存在。