ActionBar - PullToRefresh

Pat*_*kMA 7 android android-layout android-listview android-actionbar

我正在开发一个应用程序,您可以在其中查看BusStop时间表.用户可以使用ActionBar PullToRefresh(库)进行刷新.我的应用程序还启用了KitKat上的半透明状态栏.

现在ActionBar Overlay(通常应与操作栏重叠)现在向上移位.

我怎么解决这个问题?

最好的祝福!

Mar*_*ema 10

我所做的是为pull-to-refresh布局创建自定义标题布局.我只是复制了原来的一个,添加了状态栏的高度,通常为25dp并添加了25dp的顶部填充.

<?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>
Run Code Online (Sandbox Code Playgroud)

现在,在设置pull to refresh布局时设置布局:

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

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

}).headerLayout(R.layout.header).build()).setup(ptrLayout);
Run Code Online (Sandbox Code Playgroud)