Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

custom progress drawable not showing sometimes

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

sometimes it shows and sometimes its not.

I tried cleaning my project, restarting eclipse and even restart the computer.

its still happens.

here is the progress drawable xml:

<?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's 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>
like image 567
piojo Avatar asked Oct 18 '12 16:10

piojo


1 Answers

try with this

android:indeterminateDrawable="@drawable/yourXML"

it is working for me..

like image 142
Sanket Kachhela Avatar answered Oct 08 '22 23:10

Sanket Kachhela