搜尋此網誌

2010年11月18日 星期四

[Android]標題欄進度指示器使用方法

瀏覽器在載入網頁時等待時間可能會在標題欄的右上角有一個小圓圈在不斷旋轉,其不包含具體進度
作為標題欄進度指示器其實屬於Activity類的方法,在使用時我們首先需要在setContentView之前聲明requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
在需要顯示進度時用setProgressBarIndeterminateVisibility(true);
停止時用setProgressBarIndeterminateVisibility(false);


import android.view.Window;
import android.view.WindowManager;

@Override
public void onCreate(Bundle savedInstanceState) {

   super.onCreate(savedInstanceState);

   //顯示標題欄進度指示器
   requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

   //需要顯示進度時用 true 停止時用 false
   setProgressBarIndeterminateVisibility(true);

   setContentView(R.layout.viewer);

   .......................
}


來源http://zhuyonghui116.blog.hexun.com.tw/48417668_d.html

沒有留言:

張貼留言

標籤