本文主要是介绍android的UI中经常出现的菊花圈(圆形的加载圈),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
夜深也是无聊,翻看以前的老代码,发现那个我们经常用的菊花圈,原来是帧动画做的,有点意思。突然感觉帧动画做的东西效果不错啊,至少看起来听耐看的。开工上代码:
先是布局文件:
<RelativeLayout 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:background="@drawable/login_bg" ><ProgressBarandroid:layout_width="24dip"android:layout_height="24dip"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginBottom="100dip"android:indeterminate="true"android:indeterminateDrawable="@drawable/progress_animation" /></RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"android:oneshot="false" ><itemandroid:drawable="@drawable/pull_ref_pb_1"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_2"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_3"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_4"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_5"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_6"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_7"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_8"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_9"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_10"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_11"android:duration="80"/><itemandroid:drawable="@drawable/pull_ref_pb_12"android:duration="80"/></animation-list>
package com.woyou.frameanimation;import java.util.Timer;
import java.util.TimerTask;import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;/*** 菊花圈布局* @author Administrator* */
public class FrameActivity extends ActionBarActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.login_main);Timer timer = new Timer();timer.schedule(new TimerTask() {@Overridepublic void run() {Intent intent = new Intent(FrameActivity.this, LoginActivity.class);startActivity(intent);finish();}}, 5000);}}
定时久点在让他跳转过去吧...效果图
这篇关于android的UI中经常出现的菊花圈(圆形的加载圈)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!