android的UI中經常出現的菊花圈(圓形的載入圈),androidui

來源:互聯網
上載者:User

android的UI中經常出現的菊花圈(圓形的載入圈),androidui

夜深也是無聊,翻看以前的老代碼,發現那個我們經常用的菊花圈,原來是幀動畫做的,有點意思。突然感覺幀動畫做的東西效果不錯啊,至少看起來聽耐看的。開工上代碼:

先是布局檔案:

<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" >   <ProgressBar       android: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" >    <item        android:drawable="@drawable/pull_ref_pb_1"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_2"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_3"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_4"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_5"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_6"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_7"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_8"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_9"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_10"        android:duration="80"/>    <item        android:drawable="@drawable/pull_ref_pb_11"        android:duration="80"/>    <item        android: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);}}

定時久點在讓他跳轉過去吧...


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.