0
我正在切換到Slider API以獲取不確定的進度條。我正在關注this教程。一切正常,除了不確定的進度條沒有出現。mSlider.startIndeterminate()不起作用
最終的結果應該是這個樣子:
下面是一些獲取視頻的活動,同時顯示一個不確定的滑塊等待結果。
public class SearchActivity extends Activity {
//...
private Slider.Indeterminate mIndeterminate;
private CardScrollView mCardScroller;
private Slider mSlider;
@Override
protected void onCreate(Bundle bundle){
super.onCreate(bundle);
keyword = (String)getIntent().getSerializableExtra("keywords");
mCardScroller = new CardScrollView(this);
mCardScroller.setAdapter(new CardAdapter(createCards(this)));
mSlider = Slider.from(mCardScroller);
setContentView(mCardScroller);
new LoadAllVideos().execute();
}
private ArrayList<CardBuilder> createCards(Context context){
ArrayList<CardBuilder> cards = new ArrayList<>();
cards.add(new CardBuilder(context, CardBuilder.Layout.MENU)
.setText("Loading...")
.setIcon(R.drawable.ic_launcher));
return cards;
}
//...
}
在我LoadAllVideos(擴展的AsyncTask ..)我有
@Override
protected void onPreExecute(){
super.onPreExecute();
Log.w("progressbar", "start");
mIndeterminate = mSlider.startIndeterminate();
}
和
@Override
protected void onPostExecute(String url){
Log.w("progressbar", "stop");
mIndeterminate.hide();
Intent res = new Intent(SearchActivity.this, ResultActivity.class);
res.putExtra("videos", videos);
startActivity(res);
finish();
}
什麼可能我是做錯了什麼?
嘿阿蘭,這很好。謝謝。 – rottenoats 2014-12-10 08:27:52