zoukankan      html  css  js  c++  java
  • Listview加载动画

    private ArrayList<String> list;
        private Handler handler=new Handler();
        private ArrayAdapter<String> adapter;
        private GridView grid;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            TextView tv= (TextView) findViewById(R.id.tv);
             grid= (GridView) findViewById(R.id.brid);
            Animation animation=new ScaleAnimation(1.0f,2.0f,1.0f,2.0f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
            animation.setDuration(5000);
            animation.setFillAfter(true);
            tv.startAnimation(animation);
             list=new ArrayList<String>();
            for (int i=0;i<10;i++){
               list.add("我是第"+i+"");
            }
    
             adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,list);
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    grid.setAdapter(adapter);
                }
            },5000);
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context="com.bwie.wangshaoliang20170906.MainActivity">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/tv"
            android:text="哈哈哈哈哈"
            android:layout_gravity="center"
            />
    <GridView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/brid"
        android:layout_marginTop="1dp"
        android:listSelector="@color/colorAccent"
        android:drawSelectorOnTop="false"
        android:fadingEdgeLength="0.0dp"
        android:layoutAnimation="@anim/grid_layout"
        android:cacheColorHint="@android:color/transparent"
        >
    
    
    </GridView>
    </LinearLayout>
    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromXDelta="-100%"
        android:fromYDelta="0"
        android:toXDelta="0"
        android:toYDelta="0"
        android:duration="2550"
        android:interpolator="@android:anim/anticipate_overshoot_interpolator"></translate>
    </set>
    <?xml version="1.0" encoding="utf-8"?>
    <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
        android:animation="@anim/liat_anim"
        android:animationOrder="normal"
        android:delay="0.5" />
  • 相关阅读:
    javascript基础学习(三)
    javascript基础学习(二)
    javascript基础学习(一)
    php base64_encode()函数
    php fsockopen()
    php parse_url()函数
    SPL 文件处理
    CSS position的absolute和relative的解析[转]
    HTML demo
    php PDO setFetchMode
  • 原文地址:https://www.cnblogs.com/yu12/p/7482850.html
Copyright © 2011-2022 走看看