Layoutanimation sets the dynamic appearance effect (instance) for the item in the listview

Layoutanimation works on the ViewGroup and specifies an animation for the ViewGroup. When its child elements appear, they all appear according to this animation.

Layoutanimation works on ViewGroup in two ways:

1. Static implementation using XML files.

2. Dynamic implementation in code.

The following two methods are introduced by setting the dynamic appearance effect with item in listview:

The static implementation using XML file is divided into three steps

1. Define layoutanimation under the anim directory of res (there is no anim folder under the res folder, and create a new one yourself) and name it anim_ The layout is as follows:

Delay = "0.5" means that the appearance time of the latter item is 0.5 times longer than that of the previous item.

Animationorder means that the appearance order of items is normal.

anim_ Item refers to the animation effect of item.

2. Define layoutanimation in the anim directory of res and name it anim_ The item is as follows:

1. Add layoutanimation to the layout of listview.

The dynamic implementation in the code is divided into the following steps:

The above layoutanimation setting dynamic appearance effect (example) for items in listview is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>