77import android .view .MenuItem ;
88import android .view .View ;
99import android .view .animation .AccelerateDecelerateInterpolator ;
10+ import android .view .animation .AnimationUtils ;
1011import android .widget .AdapterView ;
1112import android .widget .ListView ;
1213import android .widget .Toast ;
@@ -20,16 +21,19 @@ public class MyActivity extends Activity {
2021 private ListView mListView ;
2122 private EffectAdapter mAdapter ;
2223 private View mTarget ;
24+ private YoYo .YoYoString rope ;
2325
2426 @ Override
2527 protected void onCreate (Bundle savedInstanceState ) {
2628 super .onCreate (savedInstanceState );
2729 setContentView (R .layout .activity_my );
30+
2831 mListView = (ListView )findViewById (R .id .list_items );
2932 mTarget = findViewById (R .id .hello_world );
33+
3034 mAdapter = new EffectAdapter (this );
3135 mListView .setAdapter (mAdapter );
32- rope = YoYo . with ( Techniques . FadeIn ). duration ( 1000 ). playOn ( mTarget ); // after start,just click mTarget view, rope is not init
36+
3337 mListView .setOnItemClickListener (new AdapterView .OnItemClickListener () {
3438 @ Override
3539 public void onItemClick (AdapterView <?> parent , View view , int position , long id ) {
@@ -70,7 +74,13 @@ public void onClick(View v) {
7074 }
7175 });
7276 }
73- private YoYo .YoYoString rope ;
77+
78+ @ Override
79+ public void onWindowFocusChanged (boolean hasFocus ) {
80+ if (hasFocus ){
81+ rope = YoYo .with (Techniques .FadeIn ).duration (1000 ).playOn (mTarget );// after start,just click mTarget view, rope is not init
82+ }
83+ }
7484
7585
7686 @ Override
0 commit comments