-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathActivityAnimation14.java
70 lines (54 loc) · 2.26 KB
/
ActivityAnimation14.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.xibei.personaldesign.itemDemo;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.GridLayoutAnimationController;
import android.view.animation.LayoutAnimationController;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ListView;
import com.xibei.personaldesign.DesignAdapter;
import com.xibei.personaldesign.ItemBean;
import com.xibei.personaldesign.R;
import java.util.ArrayList;
import java.util.List;
public class ActivityAnimation14 extends Activity {
ListView lv_datas;
GridView gv_datas;
DesignAdapter adapter;
List<ItemBean> dataList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_item_animation_14);
gv_datas = findViewById(R.id.gv_datas);
lv_datas = findViewById(R.id.lv_datas);
initData();
initAnimation();
}
private void initAnimation() {
Animation animation = AnimationUtils.loadAnimation(this,R.anim.main_list_slide_in_left);
LayoutAnimationController layoutAnimationController = new LayoutAnimationController(animation);
layoutAnimationController.setDelay(0.3f);
layoutAnimationController.setOrder(LayoutAnimationController.ORDER_NORMAL);
lv_datas.setLayoutAnimation(layoutAnimationController);
lv_datas.startLayoutAnimation();
GridLayoutAnimationController gridLayoutAnimationController = new GridLayoutAnimationController(animation);
gridLayoutAnimationController.setRowDelay(0.3f);
gridLayoutAnimationController.setColumnDelay(0.5f);
gridLayoutAnimationController.setDirectionPriority(GridLayoutAnimationController.PRIORITY_NONE);
gv_datas.setLayoutAnimation(gridLayoutAnimationController);
gv_datas.startLayoutAnimation();
}
private void initData() {
dataList = new ArrayList<>();
for (int i = 0;i<=9;i++){
dataList.add(new ItemBean("data"+i));
}
adapter = new DesignAdapter(dataList,this);
lv_datas.setAdapter(adapter);
gv_datas.setAdapter(adapter);
}
}