开发者

LayoutAnimation on a ListView backed by a CursorAdapter

开发者 https://www.devze.com 2023-03-04 21:28 出处:网络
I have a LayoutAnimation defined in XML and set on my ListView XML with android:layoutAnimation, so when the Activity is first created the individual rows animate on layout but when I change the Curso

I have a LayoutAnimation defined in XML and set on my ListView XML with android:layoutAnimation, so when the Activity is first created the individual rows animate on layout but when I change the Cursor linked to the CursorAdapter with changeCursor the ListView updates correctly but the rows do not animate. The Cursor is populated on a background thread (h开发者_开发百科owever populating it on the ui thread makes no difference).

How can I get the ListView to run the LayoutAnimation again when the Cursor changes? I have tried invalidateViews and requestLayout, neither of which work.


Extend ListView and CursorAdpater, it will give you much more control over the layout etc by overriding the necessary methods.

Using LayoutAnimationController in code may be preferable to XML android:layoutAnimation.

0

精彩评论

暂无评论...
验证码 换一张
取 消