android 進度條ProgressBar樣式設定

來源:互聯網
上載者:User

標籤:android 進度條progressbar樣式設定

普通圓形ProgressBar

該類型進度條也就是一個表示運轉的過程,例如傳送簡訊,串連網路等等,表示一個過程正在執行中。一般只要在XML布局中定義就可以了。 

<progressBar Android:id="@+id/widget43"

      android:layout_width="wrap_content" 

      android:layout_height="wrap_content"  

      android:layout_gravity="center_vertical">

</ProgressBar>

此時,沒有設定它的風格,那麼它就是圓形的,一直會旋轉的進度條。


超大號圓形ProgressBar

此時,給設定一個style風格屬性後,該ProgressBar就有了一個風格,這裡大號ProgressBar的風格是: style="?android:attr/progressBarStyleLarge"完整XML定義是: 

<progressBar android:id="@+id/widget196"

      android:layout_width="wrap_content" 

      android:layout_height="wrap_content"

      style="?android:attr/progressBarStyleLarge">

</ProgressBar>


小號圓形ProgressBar

小號ProgressBar對應的風格是: style="?android:attr/progressBarStyleSmall"完整XML定義是:

<progressBar android:id="@+id/widget108"

      android:layout_width="wrap_content" 

      android:layout_height="wrap_content"

      style="?android:attr/progressBarStyleSmall">

</ProgressBar>

標題型圓形ProgressBar

標題型ProgressBar對應的風格是: style="?android:attr/progressBarStyleSmallTitle"完整XML定義是: 

<progressBar android:id="@+id/widget110"

    android:layout_width="wrap_content" 

    android:layout_height="wrap_content"

    style="?android:attr/progressBarStyleSmallTitle">

</ProgressBar>



@Override

    protected void onCreate(Bundle savedInstanceState) {

        // TODO Auto-generated method stub

        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

        //請求視窗特色風格,這裡設定成不明確的進度風格

        setContentView(R.layout.second);

        setProgressBarIndeterminateVisibility(true);

        //設定標題列中的不明確的進度條是否可以顯示

    }



本文出自 “天南一方” 部落格,請務必保留此出處http://phpnan.blog.51cto.com/2641199/1654546

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.