进度条适用于Android API 23,但不适用于21或22 [英] Progress bar working on Android API 23, but not 21 or 22
本文介绍了进度条适用于Android API 23,但不适用于21或22的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是xml部分:
<ProgressBar
android:layout_width="50dp"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_marginEnd="5dp"
android:layout_alignParentEnd="true"
android:visibility="gone"
android:indeterminateTint="@color/colorPrimary"
android:id="@+id/progressBar"
android:indeterminate="true" />
我用它来显示和隐藏进度条:
I am using this to show and hide the progress bar:
progressBar.setVisibility(View.GONE);
progressBar.setVisibility(View.VISIBLE);
这就像我想要的更新手机,但在API 21和22上的进展bar永远不可见。
This is working just as I want it to on newer phones, but on API 21 and 22 the progress bar is never made visible.
推荐答案
添加 android:indeterminateTintMode =src_in
修复它:
<ProgressBar
android:layout_width="50dp"
android:layout_height="match_parent"
android:padding="15dp"
android:layout_marginEnd="5dp"
android:layout_alignParentEnd="true"
android:visibility="gone"
android:indeterminateTint="@color/colorPrimary"
android:indeterminateTintMode="src_in"
android:id="@+id/progressBar"
android:indeterminate="true" />
这篇关于进度条适用于Android API 23,但不适用于21或22的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文