我已經創建了對話框,它膨脹了xml,它獲得了更新的信息。但進度對話框顯示在彈出的對話框後面。如何在對話框的頂部顯示進度對話框,其中包含膨脹的xml。progressdialog進入對話框
public class MainActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dialog();
}
public class loadasync extends AsyncTask<Void, Void, JSONObject> {
ProgressDialog progressDialog ;
@Override
protected JSONObject doInBackground(Void... params) {
}
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog = new ProgressDialog(MainActivity.this);
progressDialog.setMessage("loading");
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.show();
}
});
}
@Override
protected void onPostExecute(JSONObject result) {
runOnUiThread(new Runnable() {
@Override
public void run() {
progressDialog.dismiss();
}
});
}
}
public void dialog() {
dialog = new Dialog(MainActivity.this);
dialog.setContentView(R.layout.dialogxml);
loadasync loadasyncdata=new loadasync();
loadasyncdata.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
dialog.show();
}