[英]Create Dialog Box with Progress Bar in android
I have successfully created one custom dialog box. 我已经成功创建了一个自定义对话框。 Dialog box is working good.
对话框工作正常。 I am using
ListView
to list out all files in the particular paths. 我正在使用
ListView
列出特定路径中的所有文件。 My Custom Dialog box contains File Name and Check Box. 我的自定义对话框包含文件名和复选框。 Selected files can be moved or deleted.
所选文件可以移动或删除。 All these working fine.
所有这些都很好。
I need to add Progress Bar inside the dialog Box. 我需要在对话框中添加进度栏。 Because Files can be deleted or moved would take some time.
由于可以删除或移动文件,需要一些时间。 How do add Progress Bar.
如何添加进度栏。 Please help me.
请帮我。
Sample Screen Shot :- (How do add Progress Bar in the Green Color) 屏幕截图示例:-(如何添加绿色的进度条)
Thank You. 谢谢。
Bala将您创建为对话框的自定义布局插入带有自定义颜色的Horizontal SCrollBar中具有绿色的水平progressBar的代码。
You have written you know how to create a custom dialog but i want to post it first: 您已经写了您知道如何创建自定义对话框的信息,但我想先发布它:
final Dialog dialog = new Dialog(MyActivity.this, R.style.CustomDialogTheme);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.info_dialog);
dialog.setTitle("Info");
dialog.setCancelable(false);
Button deleteButton = (Button) dialog.findViewById(R.id.deleteButton);
ProgressBar progressBar = (Button) dialog.findViewById(R.id.progressBar);
deleteButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// start progress
}
});
dialog.show();
And for info_dialog.xml file use 并供info_dialog.xml文件使用
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ProgressBar
android:id="progressBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.