Listview item Animation

Source: Internet
Author: User



First, let's look at the implementation results as follows:

The demo effect is as follows:
The above list shows that the gridview can be loaded one by one only when an animation is added to the gridview. I have found a lot of information on the Internet. Many people say that I use multi-threaded loading and set data changes through setadapter. handler is also used, which is too nonsense and almost gives up. You can set an animation directly in the configuration. The effect is very good, depending on the effect. The listview configuration method is as follows: [HTML]View plaincopyprint?
  1. <Gridview
  2. Android: Background = "@ drawable/navagation_shape"
  3. Android: Id = "@ + ID/gv_navagation"
  4. Android: layout_width = "match_parent"
  5. Android: layout_height = "match_parent"
  6. Android: layout_margintop = "1dip"
  7. Android: listselector = "# cdcd00"
  8. Android: drawselectid Top = "false"
  9. Android: fadingedgelength = "0.0dp"
  10. Android: layoutanimation = "@ anim/navagation_gridview_anim"
  11. Android: cachecolorhint = "@ Android: color/transparent"
  12. >
  13. </Gridview>
The key is: Android: layoutanimation = "@ anim/navagation_gridview_anim"  We create an animation XML file in the anim directory. The configuration content is as follows:: The navagation_gridview_anim.xml directory file is as follows: [HTML]View plaincopyprint?
  1. <Layoutanimation xmlns: Android = ""
  2. Android: animation = "@ anim/list_anim"
  3. Android: animationorder = "normal"
  4. Android: delay = "0.5"/>
The list_anim.xml file is created in the anim folder as follows: [HTML]View plaincopyprint?
  1. <? XML version = "1.0" encoding = "UTF-8"?>
  2. <Set xmlns: Android = "">
  3. <Translate Android: fromxdelta = "-100%"
  4. Android: fromydelta = "0"
  5. Android: toxdelta = "0"
  6. Android: toydelta = "0"
  7. Android: duration= "2550"
  8. Android: interpolator = "@ Android: anim/anticipate_overshoot_interpolator"/>
  9. </Set>
[HTML]View plaincopyprint?
    1. --------------------------------------------------------------------------------
    2. A little explanation:
    3. Android: interpolator = "@ Android: anim/anticipate_overshoot_interpolator"
    4. Here is the configured animation effect. It is a good effect to speed up to the end point (a bit later) and then return to the origin.
    5. Other meanings can be easily understood by attributes given by those who combine them.
    6. Android: fromxdelta = "-100%" // The Position of the starting abscissa ;;
    7. Android: fromydelta = "0" // The starting Coordinate Position
    8. Android: toxdelta = "0" // Where to arrive (x coordinate)
    9. Android: toydelta = "0" // Where to arrive (Y coordinate)

Listview item Animation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.