Today uses Android's volley framework to write a simple web weather capture demo.
The space that hosts the data is the ListView
Because is the network load, must first set the ListView the default data, I set is that loading ...
The data is then retrieved from the network, then parsed, then updated to adapter, and then notifydatasetchanged updated to the ListView.
However, the ListView is set to Layoutanimation, so that the default ListView opens after the loading performed the animation, when the network data load is complete,
The layoutanimation will not be executed again!
Online search without fruit, may be novice, not too familiar, sent to the CSDN also no one answered me!
Finally, my own research found that the use of XML is the way set layoutanimation, so the ListView after loading began to execute!
< ListView Android:layout_width = "Match_parent" android:layout_height= "Match_parent" android:id= "@+id/listview" android:layout_centervertical= "true" android:layoutanimation= "@anim/list_anim_layout2" android:layout_centerhorizontal= "true"/>
Then think of code execution animation, first load all animation, then the network data is loaded and updated to the ListView and then bind animation to the ListView.
1 PrivateLayoutanimationcontroller Lac;2 3 //--@ Load the listview layoutanimation animation4Lac=animationutils.loadlayoutanimation (weatheractivity. This, r.anim.list_anim_layout2);5 6 //After response7 .......8 //--@ Update data to ListView9 adapter.notifydatasetchanged ();Ten //--Set Layoutanimation to perform animation after loading is complete OneListvview.setlayoutanimation (LAC);
This realization of the predetermined function, beginners unfamiliar is a variety of tangled, not sure to turn to that corner of the turn can not come out ...!
[Email protected] January 28 11:31:25-if not strong, cowardly to whom to pity!
Android settings after the ListView data is loaded to execute layoutanimation