AppBarat v24.0.0上的AppBarLayout高程更改被延迟 [英] AppBarLayout elevation change is delayed on appCompat v24.0.0

查看:91
本文介绍了AppBarat v24.0.0上的AppBarLayout高程更改被延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Appcompat v24.0.0 中,导致在显示活动后将阴影/高程呈现为 AppbarLayout 。而且在阴影绘制到 AppbarLayout 时很容易看到滞后。

In Appcompat v24.0.0 causes rendering of shadow/elevation to AppbarLayout after Activity is visible. And a lag can easily be seen in shadow drawing to AppbarLayout.

并且在以前的Appcompat中没有此滞后库版本。

And this lag was not there in previous Appcompat library version.

使用 Appcompat v24.0.0 Appcompat v23.4.0 进行了测试,阴影图清晰可见

Tested using both Appcompat v24.0.0 and Appcompat v23.4.0, shadow drawing clearly seen in the new version.

推荐答案

这是 Appcompat v24.0.0

This is a bug in Appcompat v24.0.0.


参考文献: https://code.google.com/p/android/issues/detail?id=213895

为了最小化高程绘图中的延迟,请在您自己的 StateListAnimator中将持续时间设置为 1ms 并将其应用于 AppbarLayout

In order to minimize the delay in elevation drawing, set the duration to 1ms in your own StateListAnimator and apply it to AppbarLayout.

appbar_always_elevated.xml >在 res 目录下的 animator-v21 文件夹中。

appbar_always_elevated.xml in animator-v21 folder under res directory.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item>
        <objectAnimator android:propertyName="elevation"
                        android:valueTo="8dp"
                        android:valueType="floatType"
                        android:duration="1"/>
    </item>

</selector>

在AppbarLayout中:

In AppbarLayout :

<android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:fitsSystemWindows="true"
        android:stateListAnimator="@animator/appbar_always_elevated"
        android:theme="@style/AppTheme.AppBarOverlay">

</android.support.design.widget.AppBarLayout>

这篇关于AppBarat v24.0.0上的AppBarLayout高程更改被延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆