0
我需要一些關於如何在我的自定義對話框佈局中與水平進度對話框交互的信息。下面是XML代碼:Android使用自定義對話框中的水平進度條
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="20dp" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/progressBar1"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="@+id/progressBar1"
android:text="Communicating with Stampii..." />
<ProgressBar
android:id="@+id/progressBar2"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/progressBar1"
android:layout_margin="20dp" />
</RelativeLayout>
這裏是我用它來創建對話框代碼:提前
private void createCancelProgressDialog() {
cancelDialog = new AlertDialog.Builder(this);
cancelDialog.setView(getLayoutInflater().inflate(R.layout.sync_bars, null));
cancelDialog.setTitle("Synchronization!");
cancelDialog.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
AlertDialog alert = cancelDialog.create();
alert.show();
}
因此,如果任何人有任何建議,請不要shy.Thanks!