各种进度条效果

这里收集了进度条的9种效果:




代码:
Main.java

package com.android.chen.main;

import com.android.chen.util.IntentUtils;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

/**
* <一句话功能简述>首页面,包含三个按钮

* <功能详细描述>
*
* @author chenli
* @version [版本号, 2011-4-8]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class Main extends Activity
{
/**
* 显示圆形进度条的dialog
*/

private Dialog mDialog;
/**
* 列表 各种进度条的样式名称
*/
private ListView mListView;


@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

initProperty();
}

/**
* <一句话功能简述>初始化页面组件及事件

* <功能详细描述>
*
* @see [类、类#方法、类#成员]
*/
private void initProperty()
{
/**
*
* 列表中展示的文字内容
*/
String[] texts = {
getResources().getString(R.string.yinlian),
getResources().getString(R.string.color),
getResources().getString(R.string.left),
getResources().getString(R.string.right),
getResources().getString(R.string.indeter),
getResources().getString(R.string.vertical_pic),
getResources().getString(R.string.round_anim),
getResources().getString(R.string.round_color),
getResources().getString(R.string.round_pic)
};

mListView = (ListView) findViewById(R.id.listview);
ArrayAdapter adapter = new ArrayAdapter(this, R.layout.item,R.id.type,texts);
mListView.setAdapter(adapter);


mListView.setOnItemClickListener(new OnItemClickListener() {

@Override
public void onItemClick(AdapterView arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
Toast.makeText(Main.this, "position = " + arg2, 0).show();
switch (arg2)
{
case 0:
/**
* 通过动画达到效果
*/
// showIntent(SelfDefProgressActivity.class);
/**
* 每次移动光标达到效果
*/
showIntent(ProgressActivity.class);
/**
* 通过自定义view实现
*/
showIntent(ProgressDemoActivity.class);
break;
case 1:
showIntent(ProgressBar_Color.class);
break;
case 2:
showIntent(ProgressBar_Left.class);
break;
case 3:
showIntent(ProgressBar_Right.class);
break;
case 4:
showIntent(ProgressBar_Indeter.class);
break;
case 5:
showIntent(VerticalPic.class);
break;
case 6:
showRoundProcessDialog(Main.this, R.layout.loading_process_dialog_anim);
break;
case 7:
showRoundProcessDialog(Main.this, R.layout.loading_process_dialog_color);
break;
case 8:
showRoundProcessDialog(Main.this, R.layout.loading_process_dialog_icon);
break;
default:
break;
}
}
});
}


/**
* <一句话功能简述>Intent页面跳转

* <功能详细描述>
*
* @param mclass
* @see [类、类#方法、类#成员]
*/
private void showIntent(Class mclass)
{
IntentUtils.getInstance().intentForward(this, mclass);
}
/**
* <一句话功能简述> 显示圆形进度条

* @param mContext
* @param layout
*/
public void showRoundProcessDialog(Context mContext, int layout){
mDialog = new AlertDialog.Builder(mContext).create();

mDialog.show();
// 注意此处要放在show之后 否则会报异常
mDialog.setContentView(layout);
mDialog.setCancelable(true); //false设置点击其他地方不能取消进度条
}
}

Progress.java

/**
*@project name: ProgressDemo
*@file name: Progress.java
*@date 2012-1-17 上午11:42:07
*@author kester.zhang
*@Copyright (C) 2011 NanJing BBMF Information Technology Co., Ltd.(Shanghai Branch)
*/
package com.android.chen.main;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

/**
* @author
* */
public class Progress extends SurfaceView implements SurfaceHolder.Callback,Runnable{

/**
* 画笔对象
* */
private Paint paint;

/**
* canvas对象
* */
private Canvas canvas;

/**
* surfaceholder对象
* */
private SurfaceHolder holder;

/**
* 标志位
* */
private boolean flag = false;

/**
* 黑色线
* */
private Bitmap blackline;

/**
* 白色线
* */
private Bitmap whiteline;
/**
* 背景
* */
private Bitmap background;

/**
* 亮点
* */
private Bitmap light;

/**
* 刷新频率
* */
private long delay = 100;

/**
* 热点的长度
* */
private int clipx;

/**
* 进度条移动步长
* */
private static final int foot = 10;

private onFinishLinstener ofl;


public Progress(Context context) {
super(context);
init();
}

private void init(){

holder = this.getHolder();
holder.addCallback(this);
paint = new Paint();
paint.setDither(true);

background = BitmapFactory.decodeResource(getResources(), R.drawable.bg);

blackline = BitmapFactory.decodeResource(getResources(), R.drawable.a1);

whiteline = BitmapFactory.decodeResource(getResources(), R.drawable.a2);

light = BitmapFactory.decodeResource(getResources(), R.drawable.c);

}

public void surfaceCreated(SurfaceHolder holder) {
flag = true;
new Thread(this).start();
}

public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {

}

public void surfaceDestroyed(SurfaceHolder holder) {
flag = false;
}

private void draw(){

try{

canvas = holder.lockCanvas();

synchronized (canvas) {
canvas.drawBitmap(background, 0, 0, paint);
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(blackline, 20, 100, paint);
canvas.drawBitmap(light, 20+clipx-foot, 100, paint);
canvas.clipRect(new Rect(20, 100, 20+clipx, 100+light.getHeight()));
canvas.drawBitmap(whiteline, 20,100, paint);

}

}finally{

if(canvas != null){

holder.unlockCanvasAndPost(canvas);

}

}

}

public void run() {

while(flag && !Thread.currentThread().isInterrupted()){

if(clipx >= blackline.getWidth()){

clipx = blackline.getWidth();
//此处考虑去掉亮点,可以自己定义去掉时的clipx
flag = false;
if(ofl != null){
ofl.onSetFinishLinstener();
}
}else{
clipx += foot;
}

System.out.println("---"+clipx);

draw();

try{

Thread.sleep(delay);
}catch(Exception e){
e.printStackTrace();
Thread.currentThread().interrupt();
}

}


}

public void setOnFinishLinstener(onFinishLinstener ofl) {
this.ofl = ofl;
}


public interface onFinishLinstener{
public void onSetFinishLinstener();
}

}

ProgressActivity.java

package com.android.chen.main;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;

public class ProgressActivity extends Activity {

private ProgressBar progress;
private ImageView image;
private Handler mHandler;
private LayoutParams lp;
private float pro = 0;
private double a;
private double width;
private double offest;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.selfdef1);
progress = (ProgressBar) findViewById(R.id.myProgress);
image = (ImageView) findViewById(R.id.image);
mHandler = new Handler();

new Thread(new Runnable() {
public void run() {
while (pro < progress.getMax()) {
pro += 1;
a = pro / progress.getMax();
width = progress.getWidth();
offest = a * width - image.getWidth() / 2;
Log.d("isRun", "a--->" + a + "width ------>" + width
+ "offest ------->" + offest);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
mHandler.post(new Runnable() {
public void run() {
if (offest >= 30
&& offest <= progress.getWidth() - 90) {
lp = new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
lp.setMargins((int) offest, 5, 0, 0);
lp.addRule(RelativeLayout.CENTER_VERTICAL);
image.setVisibility(View.VISIBLE);
image.setLayoutParams(lp);
} else if(offest > progress.getWidth() - 90){
image.setVisibility(View.GONE);
pro = 0;
finish();
}
progress.setProgress((int) pro);
}
});
}

}
}).start();
}
}

ProgressBar_Color.java

package com.android.chen.main;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;

import com.android.chen.util.IntentUtils;

/**
* <一句话功能简述>从左向右运动的自定义颜色进度条

* <功能详细描述>
*
* @author chenli
* @version [版本号, 2011-4-8]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class ProgressBar_Color extends Activity
{

/**
* 进度条
*/
private ProgressBar mColor = null;

/**
* 当前进度的值
*/
private int mCount = 0;

/**
* Handler消息处理
*/
private Handler mHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
if (msg.what == IntentUtils.HANDLER_LEFT)
{
finish();
}
super.handleMessage(msg);
}
};

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mypage_color);

showIndeterDialog();
}

/**
* <一句话功能简述>展示进度条的进度

* <功能详细描述>
*
* @see [类、类#方法、类#成员]
*/
private void showIndeterDialog()
{
mCount = 0;

mColor = (ProgressBar) findViewById(R.id.progress_horizontal_color);
mColor.setMax(100);
mColor.setProgress(0);
mColor.setIndeterminate(false);
new Thread()
{
public void run()
{
try
{
while (mCount <= 100)
{
mColor.setProgress(mCount++);
Thread.sleep(100);
}
if (mCount > 100)
{
mHandler.sendEmptyMessage(IntentUtils.HANDLER_LEFT);
}
}
catch (Exception ex)
{
}
}
}.start();
}
}

ProgressBar_Indeter.java

package com.android.chen.main;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;

import com.android.chen.util.IntentUtils;

/**
* <一句话功能简述>不定进度的进度条

* <功能详细描述>
*
* @author chenli
* @version [版本号, 2011-4-8]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class ProgressBar_Indeter extends Activity
{

/**
* Handler消息处理
*/
private Handler mHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
if (msg.what == IntentUtils.HANDLER_INDETER)
{
finish();
}
super.handleMessage(msg);
}
};

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mypage_indeter);

// 延时发送消息
mHandler.sendEmptyMessageDelayed(IntentUtils.HANDLER_INDETER, 3000);
}
}

ProgressBar_Left.java

package com.android.chen.main;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

import com.android.chen.util.IntentUtils;

/**
* <一句话功能简述>从左向右运动的进度条

* <功能详细描述>
*
* @author chenli
* @version [版本号, 2011-4-8]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class ProgressBar_Left extends Activity {

/**
* 进度条
*/
private ProgressBar mLeft = null;

/**
* 当前进度的值
*/

private SeekBar mSeekBar = null;

Context mContext;

/**
* Handler消息处理
*/
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.what == IntentUtils.HANDLER_LEFT) {
mLeft.setIndeterminate(true);
}
super.handleMessage(msg);
}
};

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mypage_left);
mContext = this;
showIndeterDialog();
}

/**
* <一句话功能简述>展示进度条的进度

* <功能详细描述>
*
* @see [类、类#方法、类#成员]
*/
private void showIndeterDialog() {

mLeft = (ProgressBar) findViewById(R.id.progress_horizontal_left);
mSeekBar = (SeekBar) findViewById(R.id.seekBar);
mLeft.setMax(100);
mLeft.setProgress(0);
mLeft.setIndeterminate(false);
mSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub

}

public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub

}

public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
mLeft.setProgress(progress);
// mHandler.sendEmptyMessage(IntentUtils.HANDLER_LEFT);
}
});

}
}

ProgressBar_Right.java

package com.android.chen.main;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;

import com.android.chen.util.IntentUtils;

/**
* <一句话功能简述>从右向左运动的进度条

* <功能详细描述>
*
* @author chenli
* @version [版本号, 2011-4-8]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class ProgressBar_Right extends Activity
{

/**
* 进度条
*/
private ProgressBar mRight = null;

/**
* 当前进度的值
*/
private int mCount = 0;

/**
* Handler消息处理
*/
private Handler mHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
if (msg.what == IntentUtils.HANDLER_RIGHT)
{
finish();
}
super.handleMessage(msg);
}
};

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.mypage_right);

showIndeterDialog();
}

/**
* <一句话功能简述>展示进度条的进度

* <功能详细描述>
*
* @see [类、类#方法、类#成员]
*/
private void showIndeterDialog()
{
mCount = 100;

mRight = (ProgressBar) findViewById(R.id.progress_horizontal_right);
mRight.setMax(100);
mRight.setProgress(0);
mRight.setIndeterminate(false);
new Thread()
{
public void run()
{
try
{
while (mCount >= 0)
{
mRight.setProgress(mCount--);
Thread.sleep(100);
}
if (mCount < 0)
{
mHandler.sendEmptyMessage(IntentUtils.HANDLER_RIGHT);
}
}
catch (Exception ex)
{
}
}
}.start();
}
}

ProgressDemoActivity.java

package com.android.chen.main;

import com.android.chen.main.Progress.onFinishLinstener;

import android.app.Activity;
import android.os.Bundle;

public class ProgressDemoActivity extends Activity {
private Progress progress;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
progress = new Progress(this);
setContentView(progress);
progress.setOnFinishLinstener(new onFinishLinstener() {

@Override
public void onSetFinishLinstener() {
// TODO Auto-generated method stub
finish();
}
});
}
}


SelfDefProgressActivity.java

package com.android.chen.main;

import android.app.Activity;
import android.graphics.drawable.ClipDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.AbsoluteLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

public class SelfDefProgressActivity extends Activity {

private ImageView mView;
ImageView mImageView01;
int a = 6;
int ScreenY;
ClipDrawable cd;

@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.selfdef);

Toast.makeText(this, "SelfDefProgressActivity", 0).show();
/*
* ImageView iv=(ImageView) findViewById(R.id.iv_c);
* iv.setVisibility(View.VISIBLE);
* iv.setAnimation(outToRightAnimation()); //iv.setScaleType(scaleType);
* LayoutParams params = new LayoutParams(params); params.x =
* -80;//设置x坐标 params.y = -60;//设置y坐标 iv.setLayoutParams(new
* LayoutParams(arg0))
*/
/* 取得屏幕对象 */
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);

/* 取得屏幕解析像素 */
int ScreenX = dm.widthPixels;
ScreenY = dm.heightPixels;
Toast.makeText(
this,
"" + ScreenX + ":" + ScreenY + " "
+ (ScreenY / 2 - ((ScreenY * 22) / 480)), 1).show();
Log.d("b", ScreenX + ":" + ScreenY);
mImageView01 = (ImageView) findViewById(R.id.iv_c);
mImageView01.setVisibility(View.VISIBLE);
mImageView01.setLayoutParams(new AbsoluteLayout.LayoutParams(20, 20,
(int) 100, 100));

mView = new ImageView(this) {
{
setImageResource(R.drawable.clip_bitmap_4);
setBackgroundResource(R.drawable.clip_btimap_content2);
cd = (ClipDrawable) getDrawable();
cd.setLevel(100);
setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (cd.getLevel() >= 9500) {
a = 6;
cd.setLevel(100);
}
cd.setLevel(cd.getLevel() + 100);
}
});

mHandler.sendEmptyMessageDelayed(1, 100);
}
};

((LinearLayout) findViewById(R.id.self_layout)).addView(mView);
}

private final Handler mHandler = new Handler() {
public void handleMessage(android.os.Message msg) {
if (mView != null) {
a += 3;
if (a > 308) {
a = 9;
cd.setLevel(10000);
}
// Log.e("b","a="+a+":v="+cd.getLevel());12/480=x/y
mImageView01
.setLayoutParams(new AbsoluteLayout.LayoutParams(20,
20, (int) a,
(ScreenY / 2 - ((ScreenY * 6) / 480))));
mView.performClick();

// mView.setOnTouchListener(l);
// mView.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(),
// SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, 300,
// 200, 0));
sendEmptyMessageDelayed(1, 100);

}
};
};

protected Animation outToRightAnimation() {

Animation outtoRight = new TranslateAnimation(

Animation.RELATIVE_TO_PARENT, -1.0f,

Animation.RELATIVE_TO_PARENT, +1.0f,

Animation.RELATIVE_TO_PARENT, 0.0f,

Animation.RELATIVE_TO_PARENT, 0.0f);

outtoRight.setDuration(2000);
// outtoRight.setStartOffset(startOffset)
outtoRight.setInterpolator(new LinearInterpolator());
outtoRight.setRepeatCount(Animation.INFINITE);
return outtoRight;

}
}

VerticalPic.java

package com.android.chen.main;

import com.android.chen.util.IntentUtils;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ProgressBar;

public class VerticalPic extends Activity {
/** Called when the activity is first created. */
ProgressBar pb ;
/**
* 进度条
*/
private ProgressBar mColor = null;

/**
* 当前进度的值
*/
private int mCount = 0;

/**
* Handler消息处理
*/
private Handler mHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
if (msg.what == IntentUtils.HANDLER_LEFT)
{
finish();
}
super.handleMessage(msg);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.vertical_process);
showIndeterDialog();
}


/**
* <一句话功能简述>展示进度条的进度

* <功能详细描述>
*
* @see [类、类#方法、类#成员]
*/
private void showIndeterDialog()
{
mCount = 0;

mColor = (ProgressBar) findViewById(R.id.pb);
mColor.setMax(100);
mColor.setProgress(0);
mColor.setIndeterminate(false);
new Thread()
{
public void run()
{
try
{
while (mCount <= 100)
{
mColor.setProgress(mCount++);
Thread.sleep(100);
}
if (mCount > 100)
{
mHandler.sendEmptyMessage(IntentUtils.HANDLER_LEFT);
}
}
catch (Exception ex)
{
}
}
}.start();
}
}

IntentUtils.java

package com.android.chen.util;

import android.content.Context;
import android.content.Intent;

/**
* <一句话功能简述>Intent工具类

* <功能详细描述>
*
* @author chenli
* @version [版本号, 2011-4-8]
* @see [相关类/方法]
* @since [产品/模块版本]
*/
public class IntentUtils
{
/**
* 从左向右
*/
public static final int HANDLER_LEFT = 0;

/**
* 从右向左
*/
public static final int HANDLER_RIGHT = 1;

/**
* 不确定进度
*/
public static final int HANDLER_INDETER = 2;

/**
* IntentUtils单例
*/
private static IntentUtils mIntentUtils;

/**
* <一句话功能简述>获取IntentUtils单例

* <功能详细描述>
*
* @return
* @see [类、类#方法、类#成员]
*/
public static IntentUtils getInstance()
{
if (mIntentUtils == null)
{
mIntentUtils = new IntentUtils();
}
return mIntentUtils;
}

/**
* <一句话功能简述>Intent页面跳转

* <功能详细描述>
*
* @param context
* @param mclass
* @see [类、类#方法、类#成员]
*/
public void intentForward(Context context, Class mclass)
{
Intent intent = new Intent();
intent.setClass(context, mclass);
context.startActivity(intent);
}
}

xml布局文件:
main.xml


android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">

android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listview"
>




loading_process_dialog_anim.xml


android:orientation="horizontal" android:layout_width="wrap_content"
android:background="@color/brown"
android:layout_height="wrap_content" android:gravity="center">

android:layout_width="wrap_content" android:layout_height="wrap_content"
android:indeterminate="false" android:indeterminateDrawable="@anim/loading" />

android:layout_height="wrap_content" android:text="@string/loading" />



loading_process_dialog_color.xml


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/brown"
android:gravity="center"
android:orientation="horizontal" >

android:id="@+id/loading_process_dialog_progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="false"
android:indeterminateDrawable="@drawable/dialog_style_xml_color" />

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/loading" />



loading_process_dialog_icon.xml


android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/brown"
android:gravity="center"
android:orientation="horizontal" >

android:id="@+id/loading_process_dialog_progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="false"
android:indeterminateDrawable="@drawable/dialog_style_xml_icon" />

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/loading" />


mypage_color.xml


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >

android:id="@+id/progress_horizontal_color"
style="@style/progressBarHorizontal_color"
android:layout_width="200dip"
android:layout_height="10dip"
android:indeterminate="true"
android:max="100"
android:progress="41" />


mypage_indeter.xml


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >

android:id="@+id/progress_horizontal_indeter"
style="@style/progressBarHorizontal_indeter"
android:layout_width="200dip"
android:layout_height="10dip"
android:indeterminate="true"
android:max="100"
android:progress="41" />


mypage_left.xml


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >

android:id="@+id/progress_horizontal_left"
style="@style/progressBarHorizontal"
android:layout_width="200dip"
android:layout_height="10dip"
android:max="100"
android:progress="41" />

android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />


mypage_right.xml


android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">
style="@style/progressBarHorizontal_arabia" android:layout_width="200dip"
android:layout_height="10dip" android:max="100" android:progress="41" />


selfdef.xml


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:background="@drawable/bg"
>
android:id="@+id/rl_body_account"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="30dip"
>

android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center"
android:id="@+id/self_layout"
>


android:id="@+id/iv_c"
android:src="http://ranfeng0610.blog.163.com/blog/@drawable/c"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
/>

selfdef1.xml


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg">

android:id="@+id/myProgress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:max="200"
android:progressDrawable="@drawable/progress_drawable" />

android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:visibility="gone"
android:background="@drawable/c" />


vertical_process.xml


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >

style="?android:attr/progressBarStyleHorizontal"
android:background="@drawable/progress_bg"
android:progressDrawable="@drawable/progress_vertical"
android:layout_width="100dp"
android:layout_height="80dp"/>




item.xml


android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >

android:id="@+id/type"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:text="@string/color"
android:gravity="center_vertical"
/>


drawable下的文件:
clip_bitmap_4.xml


xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/a2"
android:clipOrientation="horizontal"
android:gravity="left"/>

clip_btimap_content2.xml


android:insetTop="0dp"
android:insetLeft="0dp"
android:insetRight="0dp"
android:insetBottom="0dp"

>
android:src="http://ranfeng0610.blog.163.com/blog/@drawable/a1" />



dialog_style_xml_color.xml



android:pivotX="50%" android:pivotY="50%" android:fromDegrees="0"
android:toDegrees="360">
android:thicknessRatio="8" android:useLevel="false">
android:startColor="#FFFFFF" android:centerColor="#FFDC35"
android:centerY="0.50" android:endColor="#CE0000" />




dialog_style_xml_icon.xml





android:fromDegrees="0.0" android:toDegrees="360.0" android:pivotX="50.0%"
android:pivotY="50.0%" />



progress_drawable.xml




android:id="@android:id/background"
android:drawable="@drawable/a1"/>

android:id="@android:id/progress"
android:drawable="@drawable/a2"/>

progress_vertical.xml







android:clipOrientation="vertical"
android:drawable="@drawable/progress"
android:gravity="bottom" >






anim下文件:
loading.xml


xmlns:android="http://schemas.android.com/apk/res/android">








values下文件:
color.xml



#947400

strings.xml



Hello World, Testp!
Testp
银联支付进度条
水平自定义颜色进度条
水平自左向右的进度条
水平自右向左的进度条
水平不确定的进度条
垂直图片进度条
圆形动画进度条
圆形颜色进度条
圆形图片进度条
正在加载数据请稍后……


styles.xml
















图片资源:



注意:在做Android4.0的开发时,发现AlertDialog相比较以前有了较大变化,就是在触摸对话框边缘外部,对话框消失

于是研究其父类发现,可以设置这么一条属性,当然必须先AlertDialog.Builder.create()之后才能调用这两个方法


方法一:


setCanceledOnTouchOutside(false);调用这个方法时,按对话框以外的地方不起作用。按返回键还起作用


方法二:


setCanceleable(false);调用这个方法时,按对话框以外的地方不起作用。按返回键也不起作用


这两个方法都属于Dialog方法,可自行查阅SDK

你可能感兴趣的:(android,app)