当我尝试更改我的 indeteminateDrawable 进度条时(我必须更改我的进度条的drawable。我尝试了无效,requestLayout 和其他。我不知道如何解决它。谢谢............ ..
这里代码:
progressBar.setIndeterminateDrawable(getResources().getDrawable(R.drawable.progress_indeterminate_horizontal_didnt_like));
progressBar.setIndeterminate(true);
是的。它在 XML 中可见。
<ProgressBar
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:indeterminateDrawable="@drawable/progress_indeterminate_horizontal_to_review" />
private void showProgressByCategory(String category) {
progressBar = (ProgressBar) findViewById(R.id.progress);
switch (CATEGORY.getPosition(category)) {
case CATEGORY.DIDNT_LIKE_POS:
// Didnt like
progressBar.setIndeterminateDrawable(getResources().getDrawable(
R.drawable.progress_indeterminate_horizontal_didnt_like));
break;
case CATEGORY.TO_SEE_POS:
// To See
progressBar.setIndeterminateDrawable(getResources().getDrawable(
R.drawable.progress_indeterminate_horizontal_to_see));
break;
case CATEGORY.SAW_AND_LIKED_POS:
// Saw And Liked
progressBar.setIndeterminateDrawable(getResources().getDrawable(
R.drawable.progress_indeterminate_horizontal_saw_liked));
break;
case CATEGORY.TO_REVIEW_POS:
// To Review
progressBar.setIndeterminateDrawable(getResources().getDrawable(
R.drawable.progress_indeterminate_horizontal_to_review));
break;
}
progressBar.setIndeterminate(true);
}