Android 旋转圈
我想实现这样一个ProgressDialog,不需要额外的框架:Android 旋转圈,android,android-layout,android-progressbar,Android,Android Layout,Android Progressbar,我想实现这样一个ProgressDialog,不需要额外的框架: ProgressDialog pd1; pd1=new ProgressDialog(<current context reference here>); pd1.setMessage("Loading...."); pd1.setCancelable(false); pd1.show(); 但我要买这个。我怎样才能改变这一点 ProgressDialog pd1; pd1=new ProgressDialog(&
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
但我要买这个。我怎样才能改变这一点
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
这是我的ProgressDialog代码。
提前谢谢
private ProgressDialog mProgressDialog;
............
mProgressDialog = new ProgressDialog(activity);
mProgressDialog.setIndeterminate(false);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
............
public class ProgressTask extends AsyncTask <Fragment,Void,Fragment>{
@Override
protected void onPreExecute(){
mProgressDialog.show();
}
@Override
protected Fragment doInBackground(Fragment... arg0) {
//my stuff is here
}
@Override
protected void onPostExecute(Fragment result) {
mProgressDialog.dismiss();
}
}
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
private ProgressDialog mProgressDialog;
............
mProgressDialog=新建进度对话框(活动);
mProgressDialog.setUndeterminate(false);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE\u微调器);
............
公共类ProgressTask扩展了AsyncTask{
@凌驾
受保护的void onPreExecute(){
mProgressDialog.show();
}
@凌驾
受保护的片段doInBackground(片段…arg0){
//我的东西在这里
}
@凌驾
受保护的void onPostExecute(片段结果){
mProgressDialog.disclose();
}
}
将此XML仅显示控制盘:
<ProgressBar
android:indeterminate="true"
android:id="@+id/marker_progress"
style="?android:attr/progressBarStyle"
android:layout_height="50dp" />
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
只需在布局中将
ProgressDialog
更改为ProgressBar
:
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
res/layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
//Your content here
</LinearLayout>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone"
android:indeterminateDrawable="@drawable/progress" >
</ProgressBar>
</RelativeLayout>
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
我使用的是
视图。不可见的和视图。可见的和进度条会慢慢闪烁,而不是一直可见,切换到视图。消失的和视图。可见的,它工作得很好试试这个
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
ProgressBar对话框-无需一直编写自定义ProgressBar代码,创建一个以下类并使用
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
R.layout.dialog\u api\u加载
ProgressDialog pd1;
pd1=new ProgressDialog(<current context reference here>);
pd1.setMessage("Loading....");
pd1.setCancelable(false);
pd1.show();
谢谢您的回答。我应该把什么放在可绘图文件夹中?(什么是进度文件?)color\u preload\u center、color\u preload\u end和color\u preload\u start的颜色代码值是什么?这个答案的Thx:)有没有办法让它旋转得更快?@SankarV我用了#000000#ff56a9c7I在drawable/progress.xml中更改了大小标记中的高度和宽度值,但它没有任何效果。有什么想法吗?你可以试试这个来创建自定义对话框。这个答案对我有用。只有代码答案是不鼓励的。请提供您的答案如何解决问题的摘要,以及为什么它可能比提供的其他答案更可取。