Certain ProgressBar styles not shown on Nexus 5 Android 5.0.1

后端 未结 3 1516
误落风尘
误落风尘 2020-12-15 17:23

I have the following layout:




        
相关标签:
3条回答
  • 2020-12-15 18:03

    In my case, it looks as if the issue is with build LRX22G:

    Nexus 7 using Build LRX22G (android-5.0.2_r1) - progress bar not shown
    
    Nexus 5 using Build LRX22C (android-5.0.1_r1) - progress bar shown
    

    See https://source.android.com/source/build-numbers.html

    It's probably also related with https://code.google.com/p/android/issues/detail?id=77865

    Not being able to wait for a fix, what I've decided to do is to force the Holo progress bar to be used in my Material theme. This is how it was achieved - it may be of some use to you in the meantime:

    <style name="AppBaseTheme" parent="@android:style/Theme.Material.Light.DarkActionBar">
    
        <!-- Build LRX22G (5.0.2 Nexus 7) fails to display progress bar so we'll use Holo instead of Material -->
        <!-- http://stackoverflow.com/questions/27567235/certain-progressbar-styles-not-shown-on-nexus-5-android-5-0-1 -->
        <item name="android:progressBarStyleSmall">@style/MaterialProgressBarFix.Small</item>
        <item name="android:progressBarStyle">@style/MaterialProgressBarFix</item>
        <item name="android:progressBarStyleLarge">@style/MaterialProgressBarFix.Large</item>
    </style>
    
    <style name="MaterialProgressBarFix.Small" parent="@android:style/Widget.Holo.ProgressBar.Small" />
    <style name="MaterialProgressBarFix"       parent="@android:style/Widget.Holo.ProgressBar" />
    <style name="MaterialProgressBarFix.Large" parent="@android:style/Widget.Holo.ProgressBar.Large" />
    
    0 讨论(0)
  • 2020-12-15 18:04

    I was having the same issue but was because the developer phone have animations scales to 0 (all 3).

    Enable all the animations on the device and maybe you will be able to see the progress bar, so for normal people that will have animations enabled the progress bar will appear fine.

    0 讨论(0)
  • 2020-12-15 18:23

    By setting the style to the following instead you should be able to debug this issue

    style="?android:attr/progressBarStyleLarge"
    
    0 讨论(0)
提交回复
热议问题