asc*_*sco 25 android android-layout android-progressbar android-5.0-lollipop
我有以下布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <ProgressBar
        style="@android:style/Widget.Material.ProgressBar.Large"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我有一个Android 5.0.1不显示的Nexus 5运行ProgressBar,显然是因为风格.当我将样式设置为例如
 style="@android:style/Widget.ProgressBar.Large"
Run Code Online (Sandbox Code Playgroud)
要么
 style="@android:style/Widget.Holo.ProgressBar.Large"
Run Code Online (Sandbox Code Playgroud)
它显示.我有一个相同的Nexus 5也运行Android 5.0.1,显示所有ProgressBar的罚款.在开发人员选项中启用"绘制布局边框"选项,它显示它ProgressBar包含在布局中,它根本不显示.
这看起来很奇怪,有什么想法可以在这里发生什么?

在我的情况下,看起来问题是与构建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
Run Code Online (Sandbox Code Playgroud)
请参阅https://source.android.com/source/build-numbers.html
它可能还与https://code.google.com/p/android/issues/detail?id=77865有关
无法等待修复,我决定做的是强制在我的材质主题中使用Holo进度条.这就是它的实现方式 - 在此期间它可能对你有用:
<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" />
Run Code Online (Sandbox Code Playgroud)
        |   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           4393 次  |  
        
|   最近记录:  |