Customizable progress, sometimes not showing

I have a very strange problem - I defined custom progress for the progress bar and

sometimes it shows, and sometimes not.

I tried to clean my project, restart eclipse and even restart the computer.

still happening.

here is the progress xml can do:

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="5dp" /> <gradient android:startColor="#6f7754" android:endColor="#858762" android:angle="90"/> </shape> </item> <item android:id="@android:id/secondaryProgress"> <clip> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="5dp" /> <gradient android:startColor="#ffba00" android:endColor="#af6c03" android:angle="90"/> </shape> </clip> </item> <item android:id="@android:id/progress"> <clip> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="5dp" /> <gradient android:startColor="#ffba00" android:endColor="#af6c03" android:angle="90" /> </shape> </clip> 

and here is the xml where I use it:

 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:layout_marginBottom="2dp" android:background="@drawable/quick_action_item_btn"> <ImageView android:id="@+id/icon" android:layout_width="21dp" android:layout_height="21dp" android:scaleType="centerInside"/> <ProgressBar android:id="@+id/progress" android:layout_width="20dp" android:layout_height="4dp" android:layout_marginTop="2dp" style="@android:style/Widget.ProgressBar.Horizontal" android:progressDrawable="@drawable/achievement_progress_bar"/> </LinearLayout> 
+4
source share
3 answers

try with this

 android:indeterminateDrawable="@drawable/yourXML" 

It works for me ..

+6
source

Perhaps this is a similar problem with this ... SharedPreferences.onSharedPreferenceChangeListener is not called sequentially

Is custom xml defined as an activity variable? If not, perhaps it is being collected by the garbage collector. My suggestion is to make it a class field variable (activity class).

0
source

His work is wonderful for me. Just set your undefined path to custum xml.It file should be fine ..

0
source

Source: https://habr.com/ru/post/1440586/


All Articles