Social Icons

2013年5月6日 星期一

今天我學到 - SherlockActionBar的Indeterminate Progress bar

最近在使用SherlockActionBar遇到一些問題,特地把它的使用方式記錄一下。


有看到右上角那個轉轉轉的圈圈嗎,那個就是Indeterminate Progress Bar,在建立這個Progress bar之前一定要符合如下順序

// requestWindowFeature要在super.onCreate之前呼叫
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// setSupportProgressBarIndeterminateVisisbility要在setContentView之後呼叫
setSupportProgressBarIndeterminateVisibility(false);

別忘了,為了向後相容我們使用SherlocakActionBar,所以不能使用setProgressBarIndeterminateVisibilty,而是要用setSupportProgressBarIndeterminateVisibility哦,不然在Android2.x的版本是不動作的。

沒有留言:

張貼留言