forked from D-clock/AndroidStudyCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimationTestActivity.java
More file actions
67 lines (54 loc) · 1.82 KB
/
AnimationTestActivity.java
File metadata and controls
67 lines (54 loc) · 1.82 KB
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
package com.clock.study.activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.widget.BaseAdapter;
import android.widget.ListView;
import com.clock.study.R;
import com.clock.study.animation.SimpleCustomAnimation;
/**
* 测试Animation动画效果
*/
public class AnimationTestActivity extends AppCompatActivity implements View.OnClickListener {
private ListView mTestListView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animation_test);
mTestListView = (ListView) findViewById(R.id.list_view_test);
mTestListView.setAdapter(new SimpleTestListAdapter());
findViewById(R.id.btn_test_anim).setOnClickListener(this);
}
@Override
public void onClick(View v) {
int viewId = v.getId();
if (viewId == R.id.btn_test_anim) {
Animation animation = new SimpleCustomAnimation();
animation.setDuration(1000);
mTestListView.startAnimation(animation);
}
}
private class SimpleTestListAdapter extends BaseAdapter {
@Override
public int getCount() {
return 20;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = View.inflate(parent.getContext(), R.layout.author_info_layout, null);
}
return convertView;
}
}
}