Animation显示ListView的每一条记录
Posted zqxLonely
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Animation显示ListView的每一条记录相关的知识,希望对你有一定的参考价值。
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".activity.MainActivity"> <ListView android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/listView"></ListView> </LinearLayout>
zoom_in.xml
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:duration="1000" android:fromXScale="0.1" android:fromYScale="0.1" android:pivotX="50%" android:pivotY="50%" android:toXScale="1.0" android:toYScale="1.0"/> <alpha android:duration="1000" android:fromAlpha="0" android:toAlpha="1.0"/> </set>
MainActivity.java
package com.pingyijinren.helloworld.activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; import android.widget.ArrayAdapter; import android.widget.ListView; import com.pingyijinren.helloworld.R; public class MainActivity extends AppCompatActivity { private ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView=(ListView)findViewById(R.id.listView); listView.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,new String[]{"work hard","make money","I want to be rich"})); // listView.setAnimation(AnimationUtils.loadAnimation(MainActivity.this,R.anim.zoom_in)); listView.setLayoutAnimation(new LayoutAnimationController(AnimationUtils.loadAnimation(MainActivity.this,R.anim.zoom_in))); } }
以上是关于Animation显示ListView的每一条记录的主要内容,如果未能解决你的问题,请参考以下文章
WPF 根据指定条件显示或禁止listView中的每一项的右键菜单
PHP中如何在查询结果的每一条记录后加个编辑和删除按钮,实现编辑和删除操作。