標籤: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樣式設定