标签:
mDialog = new ProgressDialog(this);
mDialog.setCancelable(true);//是否可以被取消
mDialog.setMessage("loading...");//加载显示的信息
mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);//圆环风格
mDialog.show();
mDialog = new ProgressDialog(this);
mDialog.setCancelable(true);//是否可以被取消
mDialog.setMessage("loading...");//加载显示的信息
mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);//圆环风格
mDialog.show();
mDialog.setContentView(R.layout.view_progress);//自定义布局
//注意:setContentView()要在show()后使用。
view_progress.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:padding="10dp"
android:orientation="horizontal">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@drawable/progress_black" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="loading..." />
</LinearLayout>
progress_black.xml
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loading_ball"
android:fromDegrees="0"
android:pivotX="50.0%"
android:pivotY="50.0%"
android:toDegrees="360" />
标签:
原文地址:http://blog.csdn.net/pengkv/article/details/50724832