我已經成功創建了一個自定義對話框。對話框運行良好。我正在使用ListView
列出特定路徑中的所有文件。我的自定義對話框包含文件名和複選框。所選文件可以被移動或刪除。所有這些工作正常。使用進度條創建對話框android
我需要在對話框中添加進度條。由於可以刪除或移動文件需要一些時間。如何添加進度條。請幫幫我。
示例截屏圖: - (如何添加進度條綠色)
謝謝。
我已經成功創建了一個自定義對話框。對話框運行良好。我正在使用ListView
列出特定路徑中的所有文件。我的自定義對話框包含文件名和複選框。所選文件可以被移動或刪除。所有這些工作正常。使用進度條創建對話框android
我需要在對話框中添加進度條。由於可以刪除或移動文件需要一些時間。如何添加進度條。請幫幫我。
示例截屏圖: - (如何添加進度條綠色)
謝謝。
巴拉您已爲對話創造了自定義佈局插入的水平進度具有色綠從Horizontal SCrollBar with Custom Color.
你已經寫你知道如何創建一個自定義對話框中的代碼,但我想先張貼:
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>
檢查,這可能是這適合你的問題 http://stackoverflow.com/questions/7307736/android-dialog-box-creation-with-progress-bar – 2012-07-26 10:56:46
你問怎麼添加和更新進度欄? – Sam 2014-02-26 12:14:28