ProgressBar not showing in some devices
android, android-layout, progress-bar
Solution
On some devices the progress bar could not appear because in Settings -> Developer Options -> Transition Animation Scale is OFF.
Switching this setting to ON (usually x 1) will make the progress bar to appear again.
I guess there is a proper explanation about that, but I do not have complete answer why animations off make the progress bar to not work.
Problem
I have the following layout: ``` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.pontai" android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <com.markupartist.android.widget.ActionBar android:id="@+id/actionbar" style="@style/ActionBar" android:layout_marginBottom="3dip" app:textStyleActionBar="@style/TextViewStyleHeader" app:title="@string/app_name" /> <com.fb.design.SegmentedButton android:id="@+id/main_action_bar" android:layout_width="match_parent" android:layout_height="wrap_content" app:btnText1="@string/sb_friends" app:btnText2="@string/sb_search" app:btnText3="@string/sb_summary" app:gradientColorOffEnd="@color/segmented_button_off_end" app:gradientColorOffStart="@color/segmented_button_off_start" app:gradientColorOnEnd="@color/segmented_button_on_end" app:gradientColorOnStart="@color/segmented_button_on_start" app:gradientColorSelectedEnd="@color/segmented_button_selected_end" app:gradientColorSelectedStart="@color/segmented_button_selected_start" app:whichButtonIsSelected="0" /> <View android:layout_width="wrap_content" android:layout_height="2dp" android:layout_marginBottom="3dip" android:background="@drawable/gradient_line" > </View> <LinearLayout android:id="@+id/linearLayout7" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:id="@+id/linearLayout4" android:layout_width="match_parent" android:layout_height="wrap_content" > <Button android:id="@+id/buttonAddFriends" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/ic_input_add" android:clickable="true" android:height="40dp" android:width="40dp" /> <EditText android:id="@+id/search_box" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:hint="@string/type_here_to_filter" android:inputType="text" android:maxLines="1" android:padding="10dp" > </EditText> </LinearLayout> <LinearLayout android:id="@+id/loadingPanel" style="@style/GenericProgressBackground" android:layout_height="match_parent" > <ProgressBar style="@style/GenericProgressIndicator" /> </LinearLayout> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" /> <TextView android:id="@id/android:empty" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="5dp" android:text="@string/empty_results" /> </LinearLayout> </LinearLayout> ``` My Activity has a AsyncTask that upon completion does the following: ``` ((LinearLayout)findViewById(R.id.loadingPanel)).setVisibility(View.GONE); ``` So, basically I have a LinearLayout holding my ProgressBar and, when I have the data I need, I set the visibility to GONE for this linearlayout. This is working find on my Galaxy Nexus, but it's not working on my API 8 Emulator and also in the Galaxy S2, using a custom ROM. Has anyone ever seen this? My worst case scenario will be removing this linearlayout with a progress bar from the XML and add a ProgressDialog in the code. Regards, Felipe UPDATE This is how I defined the styles.xml ``` <style name="GenericProgressBackground" parent="android:Theme"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">fill_parent</item> <item name="android:background">#77ffffff</item> <item name="android:gravity">center</item> </style> <style name="GenericProgressIndicator" parent="@android:style/Widget.ProgressBar.Large"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:indeterminate">true</item> </style> ``` UPDATE2 I fixed the issue ``` <ProgressBar android:id="@+id/progressBar1" style="?android:attr/progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" /> ``` I added the style coming from the android attributes and that alone worked... I have no idea why it didnt work with the style I created... it's weird. Thanks for the help! :)