ActionBar - PullToRefresh

android, android-actionbar, android-layout, android-listview

Solution

What I did is create a custom header layout for the pull-to-refresh layout. I just copied the original one, added the height of the status bar which is usually 25dp and added a 25dp top padding.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="73dp"
    android:paddingTop="25dp" >

    <FrameLayout
        android:id="@id/ptr_content"
        android:layout_width="match_parent"
        android:layout_height="73dp" >

        <TextView
            android:id="@id/ptr_text"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textAppearance="?android:attr/textAppearanceMedium" />
    </FrameLayout>

    <fr.castorflex.android.smoothprogressbar.SmoothProgressBar
        android:id="@id/ptr_progress"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/ptr_progress_bar_stroke_width" />

</RelativeLayout>

Now set the layout when you setup the pull to refresh layout:

ActionBarPullToRefresh.from(getActivity()).listener(new OnRefreshListener() {

    @Override
    public void onRefreshStarted(View view) {
        refresh();
    }

}).headerLayout(R.layout.header).build()).setup(ptrLayout);

Problem

I am developing an App where you can view BusStop Timetables. And users can refresh with the ActionBar PullToRefresh (Library). My app has also translucent statusbar on KitKat enabled. Now the ActionBar Overlay, which should be normally overlap the actionbar, is now displaced upwards. How can I solve that? Best regards!

Original source

Related problems