Android: Animating changes to GridView content -
i have gridview of layouts can dynamically added or removed grid.
in ios, native behavior gridview items other items in grid slide place of removed item, or slide make room when new item added.
however on android behavior changes instantly pop in on screen. tried adding custom animations each getview() call using tricks in gridview's adapter, ended causing problems seen here:
android gridview loading 0 indexed item in later index's slot when data set changes
i tried having individual views control animation instead of getview() method of adapter, end result identical.
i tried using gridlayoutanimationcontroller, this:
animation animation = animationutils.loadanimation(mactivity, r.anim.grid_item_fadein); gridlayoutanimationcontroller controller = new gridlayoutanimationcontroller(animation, .2f, .2f); mgrid.setlayoutanimation(controller);
this works on initial load of gridview content, changes content instantly pop in default.
i feel pretty simple feature, , there should easier way it. best i've seen searching online a library animates gridview items swap places in grid, isn't i'm looking (in same library, when remove item grid via deletion same instant effect i'm trying avoid occurs).
a common answer on i've seen "look @ apidemos, there tons of examples." far can see, there no examples animating gridview content changes.
any appreciated, thanks.
chet haase came out nice video on how handle listview animations properly. basic concept can applied gridviews. can find video here.
if you're developing api 1.0+, won't able use referenced animation features video mentions (such viewpropertyanimator) unless use nineoldandroids.
Comments
Post a Comment