我已经成功地创建了一个自定义对话框。对话框工作正常。我使用ListView
列出特定路径中的所有文件。我的自定义对话框包含文件名和复选框。可以移动或删除选定的文件。所有这些都工作得很好。
我需要在对话框中添加进度条。因为文件可以删除或移动,所以需要一些时间。如何添加进度条。请帮帮我。
示例屏幕截图:- (如何在绿色中添加进度条)
谢谢。
发布于 2012-07-26 18:55:44
Bala作为对话框创建的自定义布局插入来自Horizontal SCrollBar with Custom Color.的具有绿色颜色的水平progressBar的代码
发布于 2012-07-26 19:01:38
你已经写过,你知道如何创建自定义对话框,但我想先把它贴出来:
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();
和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>
https://stackoverflow.com/questions/11667674
复制相似问题