zoukankan      html  css  js  c++  java
  • android 给listview或gridview添加数据加载时的动画

    该listview实现图片的异步加载,并在加载listview数据时,添加从左向右的动画效果。

    在res目录下添加anim文件夹,创建动画xml   list_anim.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <translate 
            android:fromXDelta="-100%"
            android:fromYDelta="0"
            android:toXDelta="0"
            android:toYDelta="0"
            android:duration="500"
            android:interpolator="@android:anim/anticipate_overshoot_interpolator"/>
    
    </set>

    然后,在anim目录下再创建一个xml  navagation_gridview_anim.xml,这个xml代码不多,就四行

    <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
        android:animation="@anim/list_anim"
        android:animationOrder="normal"
        android:delay="0.5"/>

    现在,给listview或者gridview添加layoutAnimation属性

    <ListView 
            android:id="@+id/listview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#00000000"
            android:cacheColorHint="#00000000"
            android:layoutAnimation="@anim/navagation_gridview_anim"></ListView>

    至此,listview就实现了数据加载时添加动画效果

  • 相关阅读:
    编码和字符串
    表格边框总结
    自信
    jQuery入门知识点
    ASP.NET MVC路径引用总结
    JavaScript读书笔记(6)-Function
    JavaScript读书笔记(6)-Array RegExp
    JavaScript读书笔记(5)-Object Date
    python 常见的特殊方法
    pipreqs 找当前项目依赖的包
  • 原文地址:https://www.cnblogs.com/dcxz/p/3824000.html
Copyright © 2011-2022 走看看