6

I am using supportv4:22.0.0 to work with SwipeRefreshLayout. Its works fine but it show always a circular kind of progress instead of horizontal way progress .

I have attached the screenshot for better understanding

I have this enter image description here

But i want like this enter image description here

Code i am using in Layout

<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ptr_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
<ListView
            android:id="@+id/lv_news_feed_details"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:divider="#dbdfea"
            android:dividerHeight="1dp"
            android:cacheColorHint="@null"
            android:listSelector="#00000000"
             />
</android.support.v4.widget.SwipeRefreshLayout>

Java class

    mPullToRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.ptr_layout);
mPullToRefreshLayout.setOnRefreshListener(this);
mPullToRefreshLayout.setColorScheme(android.R.color.holo_blue_bright, 
            android.R.color.holo_green_light, 
            android.R.color.holo_orange_light, 
            android.R.color.holo_red_light);
Rakki s
  • 1,426
  • 1
  • 18
  • 42

1 Answers1

3

I am quite sure it is not possible with this class. You can always review source code to ensure it works as you want . setColorScheme set only color of the ring that is rotating. setColorScheme is now deprecated - so lets see

public void setColorSchemeColors(int... colors) {
        ensureTarget();
        mProgress.setColorSchemeColors(colors);
    }

and in MaterialProgressDrawable:

public void setColorSchemeColors(int... colors) {
        mRing.setColors(colors);
        mRing.setColorIndex(0);
    }

and field

private final Ring mRing;

As you can see there is no classic ProgressBar you wanted.

Mike
  • 2,547
  • 3
  • 16
  • 30