Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Certain ProgressBar styles not shown on Nexus 5 Android 5.0.1

I have the following layout:

<?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> 

I have a Nexus 5 running Android 5.0.1 that doesn't display the ProgressBar, obviously because of the style. When I set the style for example to

 style="@android:style/Widget.ProgressBar.Large" 

or

 style="@android:style/Widget.Holo.ProgressBar.Large" 

it is shown. I have an identical Nexus 5 also running Android 5.0.1 which displays all the ProgressBars fine. Enabling the 'draw layout borders' option in the developers options, it shows that the ProgressBar is included in the layout, it is simply not shown.

This seems very strange, any idea on what could be going on here?

enter image description here

like image 845
fweigl Avatar asked Dec 19 '14 13:12

fweigl


2 Answers

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.

like image 114
Daniel Gomez Rico Avatar answered Sep 25 '22 06:09

Daniel Gomez Rico


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" /> 
like image 35
Rhisiart Avatar answered Sep 22 '22 06:09

Rhisiart