动画 -- ListView列表item逐个出来(从无到有)

 1 import android.app.ListActivity;
 2 import android.os.Bundle;
 3 import android.widget.ArrayAdapter;
 4 
 5 public class MainActivity extends ListActivity {
 6     private ArrayAdapter<String> adapter;
 7     @Override
 8     protected void onCreate(Bundle savedInstanceState) {
 9         super.onCreate(savedInstanceState);
10         setContentView(R.layout.main);
11 
12         adapter = new ArrayAdapter<String>(this,
13                 android.R.layout.simple_list_item_1, new String[] { "Hello",
14                         "World", "www.baidu.com" });
15 
16         setListAdapter(adapter);
17     }
18 }

 

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     android:orientation="vertical" >
 6     <ListView
 7         android:id="@android:id/list"
 8         android:layout_width="fill_parent"
 9         android:layout_height="fill_parent"
10         android:layoutAnimation="@anim/listview_anim" />
11 </LinearLayout>

 

1 <?xml version="1.0" encoding="utf-8"?>
2 <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
3     android:animation="@anim/scale_0_1"
4     android:delay="0.5" >
5 </layoutAnimation>
6 <!-- 
7         android:delay  动画时间间隔 (延迟)
8  -->

 

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <!-- 
 3     ==  scale 渐变尺寸伸缩动画效果  ==
 4     fromXScale,fromYScale, 动画开始前X,Y的缩放,0.0为不显示, 1.0为正常大小
 5     toXScale,toYScale,    动画最终缩放的倍数, 1.0为正常大小,大于1.0放大
 6     android:duration        动画持续时间
 7  -->
 8 <scale xmlns:android="http://schemas.android.com/apk/res/android"
 9     android:fromXScale="0"
10     android:toXScale="1"
11     android:fromYScale="0"
12     android:toYScale="1"
13     android:duration="1000" />
14 
15 <!-- 
16     alpha    渐变透明度动画效果
17     scale    渐变尺寸伸缩动画效果
18     translate 画面转换位置移动动画效果
19     rotate    画面转移旋转动画效果 
20 -->

 

posted on 2014-08-31 20:20  大米稀饭  阅读(384)  评论(0编辑  收藏  举报