<ProgressBar        android:layout_width="wrap_content"        android:interpolator="@android:anim/linear_interpolator"        style="@style/ProgressBar"        android:layout_height="wrap_content" />

style:

<?xml version="1.0" encoding="UTF-8"?><resources><style name="ProgressBar" parent="@android:style/Widget.ProgressBar.Large">        <item name="android:indeterminateOnly">true</item>        <item name="android:indeterminateDrawable">@anim/cycle_anim</item>    </style></resources>

anim cycle_anim

<?xml version="1.0" encoding="utf-8"?><animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"android:drawable="@drawable/circle_drawable" android:pivotX="50%" android:pivotY="50%"android:fromDegrees="0" android:toDegrees="360" />

<ProgressBar         android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginRight="6dip"        android:layout_centerVertical="true"        android:id="@+id/loading"       android:indeterminateDrawable="@drawable/progress_bar_vertical_style"/>

progress_bar_vertical_style

<?xml version="1.0" encoding="utf-8"?>  <animated-rotate   xmlns:android="http://schemas.android.com/apk/res/android" android:pivotX="50%" android:pivotY="50%"       android:fromDegrees="0"     android:drawable="@drawable/loading_circle" android:toDegrees="360">  </animated-rotate>  

class ScanTask extends AsyncTask<Void, Integer, Void>{@Overrideprotected void onProgressUpdate(Integer... values) {super.onProgressUpdate(values);int pos = values[0];progressBar.setProgress(pos);}@Overrideprotected Void doInBackground(Void... params) {progressBar.setMax(100);for(int i= 0 ;i< 100;i++ ){publishProgress(i);try {Thread.sleep(500);} catch (InterruptedException e) {e.printStackTrace();}}return null;}@Overrideprotected void onPostExecute(Void result) {super.onPostExecute(result);}}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 用 SDK Manager.exe 无法更新 Android(安
  2. android camera HAL v3.0详细介绍(二)
  3. 屏幕元素的层次
  4. Android(安卓)error: "Apostrophe not pr
  5. 基于Android的SDIO-WIFI移植(1)
  6. Android(安卓)studio搭建开发环境
  7. Android中文按拼音排序
  8. Android之Mina频繁发送心跳包
  9. Android(安卓):Connection to http://loca
  10. Android存储方式