アニメーション--ListViewリストitemが1つずつ出てくる(無から有まで)
8362 ワード
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 -->