2012-04-25 55 views
8

我想顯示自定義對話框,如iphone hud進度欄樣式。但是,我不知道創建自定義對話框像hud進度條像iPhone上的android。我想要顯示自定義對話框像iphone HUD進度條

我想自定義對話框如下圖所示的圖像:

enter image description here

幫助我......!

謝謝......!

+3

首先也是最事情,**每個平臺都有自己的標準,用戶界面和編程**。 – 2012-07-10 06:09:38

回答

-1
 private class loadassync extends 
     AsyncTask<String, Void, Void> { 

    private final ProgressDialog dialog = new ProgressDialog(
      classname.this); 

    protected void onPreExecute() { 

     this.dialog.setMessage("loading....."); 
     this.dialog.show(); 
    } 

    protected Void doInBackground(final String... args) { 

     //add the logic while loading 
    } 

    protected void onPostExecute(final Void unused) { 

     try { 
      //add the logic after loading 
     } catch (Exception e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     if (this.dialog.isShowing()) { 
      this.dialog.dismiss(); 
     } 

    } 
} 

執行assynctask

 Loadassync mAssyn1 = new LoadAssync(); 
       mAssyn1.execute(); 
1

只要看看這個(我的)圖書館。 IOSDialog/Spinner library

這是非常容易使用和解決您的問題。有了它,你可以很容易地創建和使用微調像iOS一樣。 的代碼示例:

final IOSDialog dialog1 = new IOSDialog.Builder(IOSDialogActivity.this) 
      .setOnCancelListener(new DialogInterface.OnCancelListener() { 
       @Override 
       public void onCancel(DialogInterface dialog) { 
        dialog0.show(); 
       } 
      }) 
      .setDimAmount(3) 
      .setSpinnerColorRes(R.color.colorGreen) 
      .setMessageColorRes(R.color.colorAccent) 
      .setTitle(R.string.standard_title) 
      .setTitleColorRes(R.color.colorPrimary) 
      .setMessageContent("My message") 
      .setCancelable(true) 
      .setMessageContentGravity(Gravity.END) 
      .build(); 

Result

final IOSDialog dialog0 = new IOSDialog.Builder(IOSDialogActivity.this) 
      .setTitle("Default IOS bar") 
      .setTitleColorRes(R.color.gray) 
      .build(); 

結果:標準IOS對話框

+0

@ArtjomB。感謝您的建議。我表示這是我的圖書館。附圖是附件,但由於我的名譽很低,我只能留下鏈接。 – Samehadar 2017-06-17 15:12:20

+0

鏈接很好,因爲圖片很大並且有點分散注意力。 – 2017-06-17 16:26:25