• Android Shimmer 布局微光(闪光,闪烁)效果


    有时候需要实现类似知乎加载完成前列表中闪光的效果,这里推荐使用facebook的shimmer达到效果。
    使用起来比较便利:
    dependencies中加入:
    implementation 'com.facebook.shimmer:shimmer:0.5.0'

     

    布局中使用如下:
    
     
    

    shimmer_duration:动效周期

    执行控件的startShimmer()后

    运行效果如下:

     

     

     

    下面是官方给出的属性说明:

    Clip to Children

    Whether to clip the shimmering effect to the children, or to opaquely draw the shimmer on top of the children. Use this if your overall layout contains transparency.

    Colored

    Whether you want the shimmer to affect just the alpha or draw colors on-top of the children.

    Base Color

    If colored is specified, the base color of the content.

    Highlight Color

    If colored is specified, the shimmer's highlight color.

    Base Alpha

    If colored is not specified, the alpha used to render the base view i.e. the unhighlighted view over which the highlight is drawn.

    Highlight Alpha

    If colored is not specified, the alpha of the shimmer highlight.

    Auto Start

    Whether to automatically start the animation when the view is shown, or not.

    Duration

    Time it takes for the highlight to move from one end of the layout to the other.

    Repeat Count

    Number of times of the current animation will repeat.

    Repeat Delay

    Delay after which the current animation will repeat.

    Repeat Mode

    What the animation should do after reaching the end, either restart from the beginning or reverse back towards it.

    Direction

    The travel direction of the shimmer highlight: left to right, top to bottom, right to left or bottom to top.

    Dropoff

    Controls the size of the fading edge of the highlight.

    Intensity

    Controls the brightness of the highlight at the center

    Shape

    Shape of the highlight mask, either with a linear or a circular gradient.

    Tilt

    Angle at which the highlight is tilted, measured in degrees

    Fixed Width, Height

    Fixed sized highlight mask, if set, overrides the relative size value

    Width, Height ratio

    Size of the highlight mask, relative to the layout it is applied to.

    更多请参考:Shimmer for Android

    如果需要在flutter中使用:shimmer | Flutter Package

  • 相关阅读:
    Spring Boot Web 生成并显示二维码
    OBS使用
    数据分析:线性回归
    git 开发 分支 同步
    2022 年牛客多校第七场补题记录
    关于android studio 新建项目 是否勾选 use legacy android.support libraries
    解决证书加密问题:OpenSSL与urllib3的兼容性与优化
    PageOffice只读查看word文件并禁止复制
    @ConditionalOnProperty 注解的四个属性解释
    带你解密Linux的【Vm】
  • 原文地址:https://blog.csdn.net/loveseal518/article/details/126279358