Android 折叠工具栏布局闪烁,内容重叠
背景 我正在尝试使用Android设计支持库来制作一个包含重叠内容的折叠工具栏 它类似于Google Play Store电影页面,电影海报与上面折叠工具栏中的视差图像略微重叠 问题 我在向上滚动时遇到了一个问题,电影海报在视差图像后面,然后在顶部重新绘制。导致图像闪烁Android 折叠工具栏布局闪烁,内容重叠,android,android-layout,android-collapsingtoolbarlayout,Android,Android Layout,Android Collapsingtoolbarlayout,背景 我正在尝试使用Android设计支持库来制作一个包含重叠内容的折叠工具栏 它类似于Google Play Store电影页面,电影海报与上面折叠工具栏中的视差图像略微重叠 问题 我在向上滚动时遇到了一个问题,电影海报在视差图像后面,然后在顶部重新绘制。导致图像闪烁 <android.support.design.widget.AppBarLayout android:id="@+id/app_bar" android:layout_height="192dp"
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_height="192dp"
android:layout_width="match_parent"
app:elevation="1dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
代码
下面是使用的布局及其引用自Google的SupportDesignDemo
注释
下载了“Android API演示”,尝试了“AppBar/Parallax重叠内容”演示,它似乎工作正常,没有闪烁问题。找到了答案!很简单。向AppBarLayout添加
高程
,将修复闪烁
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_height="192dp"
android:layout_width="match_parent"
app:elevation="1dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
我的布局略有不同。在闪烁的ImageView的立面上添加至少4dp,我已经解决了这个问题。