Android MOA 之 登陆进度条

相关LoadingActivity:

 1 package com.costech.android.activity;
 2 
 3 
 4 
 5 
 6 
 7 import com.costech.android.R;
 8 
 9 import android.os.Bundle;
10 import android.os.Handler;
11 import android.app.Activity;
12 import android.content.Intent;
13 import android.view.Menu;
14 import android.view.WindowManager;
15 import android.widget.Toast;
16 
17 public class LoadingActivity extends Activity{
18 
19     @Override
20     public void onCreate(Bundle savedInstanceState) {
21         // TODO Auto-generated method stub
22         super.onCreate(savedInstanceState);    
23         setContentView(R.layout.loading);
24             
25     new Handler().postDelayed(new Runnable(){
26         @Override
27         public void run(){
28             Intent intent = new Intent (LoadingActivity.this,MainActivity.class);            
29             startActivity(intent);        
30             Toast.makeText(getApplicationContext(), "登录成功", Toast.LENGTH_SHORT).show();
31             LoadingActivity.this.finish();
32             
33         }
34     }, 1000);
35    }
36 }

 

 

相关loading配置文件:

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:tools="http://schemas.android.com/tools"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     >  
 6 
 7     <RelativeLayout
 8         android:layout_width="180dp"
 9         android:layout_height="180dp"
10         android:layout_centerInParent="true"
11         android:background="@drawable/loading_bg" >
12 
13         <LinearLayout
14             android:layout_width="fill_parent"
15             android:layout_height="fill_parent"
16             android:gravity="center"
17             android:orientation="vertical" >
18             
19             <ProgressBar
20                 android:id="@+id/progressBar1"
21                 style="?android:attr/progressBarStyleLarge"
22                 android:layout_width="wrap_content"
23                 android:layout_height="wrap_content"        
24                 android:layout_gravity="center_horizontal"
25                 
26              />
27       
28             <TextView
29                 android:layout_width="wrap_content"
30                 android:layout_height="wrap_content"
31                 android:text="正在登录"
32                    android:layout_marginTop="10dp"
33                 android:textColor="#fff"
34                 android:textSize="20sp"
35         />
36         </LinearLayout>
37 
38     </RelativeLayout>
39 
40 </RelativeLayout>

 

附上图片 

 

这个例子是来自一个仿微信的例子里面,至于作者我不太清楚是谁。

如有冒犯,请联系我。我将删除这篇文章。

posted @ 2013-11-18 22:38  超级高校の伪学霸_marco  阅读(171)  评论(0)    收藏  举报