Android ProgressBar實現載入進度條

來源:互聯網
上載者:User

標籤:

progressBar Android進度條組件。 progressBar的關鍵屬性:     android:max="100"     最大顯示進度條     android:progress="500"     第一顯示進度     android:secondaryProgress="80"     第二顯示進度     android:indeterminate="true"     設定是否精確顯示  progressBar的關鍵方法:     setProgress(int)     設定第一進度。     setSecondaryProgress(int)     設定第二進度     getProgress()     擷取第一進度     getSecondaryProgress()     擷取第二進度      incrementProgressBy(int)     增加或減少第一進度     incrementSecondaryProgressBy(int)      增加或減少第二進度     getMax()    擷取最大進度。  progressBar顯示風格:               不設定style為中環形進度條        style= "?android:attr/progressBarStyleLarge"     //大環 進度條        style= "?android:attr/progressBarStyleSmall"     //小環形進度條        style= "?android:attr/progressBarStyleHorizontal"     //水平進度條   progressBar分類           精確顯示進度和不可精確顯示進度。   標題列上的progressBar@Override        protected void onCreate(Bundle savedInstanceState) {               super.onCreate(savedInstanceState);              setContentView(R.layout. activity_main);               //啟動視窗特徵              requestWindowFeature(Window. FEATURE_PROGRESS);              requestWindowFeature(Window. FEATURE_INDETERMINATE_PROGRESS);               //顯示兩種進度條。              setProgressBarVisibility( true);              setProgressBarIndeterminateVisibility( true);              setProgress(600);     //設定帶進度的進度條的刻度  最大進度值為常量10000       } 對話方塊形式的進度條@Override        protected void onCreate(Bundle savedInstanceState) {               super.onCreate(savedInstanceState);              setContentView(R.layout. activity_main);               //建立progressDialog對象               progressDialog= new ProgressDialog(MainActivity. this);               //設定顯示風格               progressDialog.setProgressStyle(progressDialog . STYLE_HORIZONTAL);               //設定標題               progressDialog.setTitle("" );               /*               * 設定關於捧歐冠熱身賽Bar的一些屬性               */               //設定最大進度               progressDialog.setMax(100);               //設定初始化已經增長的進度               progressDialog.incrementProgressBy(50);               //指定進度條是明確顯示進度的               progressDialog.setIndeterminate( false);               //設定一個按鈕               progressDialog.setButton(DialogInterface. BUTTON_POSITIVE,"確定 ", new DialogInterface.OnClickListener() {                                           @Override                      public void onClick(DialogInterface dialog, int which) {                           Toast. makeText(MainActivity. this, "", Toast. LENGTH_LONG).show();                     }              });                             //是否可以通過返回按鈕退出對話方塊               progressDialog.setCancelable( true);               //顯示progreDialog               progressDialog.show();                     } 

Android ProgressBar實現載入進度條

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.