SwipeRefreshLayout不显示清爽的任何指示

SwipeRefreshLayout不显示清爽的任何指示

本文介绍了SwipeRefreshLayout不显示清爽的任何指示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 SwipeRefreshLayout 正在被显示在活动片段的内部使用。刷卡不进行刷新,但后,我拉下不言而喻右后卫和有对不确定的进度(动画进度条)无指示。它只是消失,但还是的调用onRefresh()时,它的完成。这里是我的布局......

I have a SwipeRefreshLayout being used inside of Fragments that are being displayed in activities. Swiping does perform the refresh, but after I pull down it goes right back up and there's no indicator of indeterminate progress (the animated progress bars). It just disappears but still calls onRefresh() when it's done. Here's my layouts…

活动的布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <FrameLayout
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

    <ListView
            android:id="@+id/left_drawer"
            android:layout_width="@dimen/nav_drawer_width"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:choiceMode="singleChoice"
            android:dividerHeight="1px"
            android:background="@color/drawer_background_gray"
            android:clipToPadding="false"/>

</android.support.v4.widget.DrawerLayout>

片段布局:

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

    <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipe_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        <ListView
                android:id="@android:id/list"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:clipToPadding="false"/>

    </android.support.v4.widget.SwipeRefreshLayout>

    <TextView
            android:id="@android:id/empty"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="@dimen/empty_text_size"
            android:layout_gravity="center"
            android:gravity="center"
            android:paddingTop="5dp"
            android:paddingBottom="5dp"
            android:paddingLeft="15dp"
            android:paddingRight="15dp"
            android:textColor="@color/brand_green"/>

    <ProgressBar
            android:id="@android:id/progress"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:indeterminateOnly="true"
            android:visibility="gone"
            android:layout_gravity="center"/>

</FrameLayout>

code初始化片段的布局:

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_list, null);
        swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container);
        swipeLayout.setOnRefreshListener(this);
        swipeLayout.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);
        return view;
}

有大致同时刷新3〜6秒的延迟,足够,它的显边看日志。它应该是可见的,并且工作得很好,当我用pcated 动作条-PullToRefresh 库现在去$ P $。我试图使 SwipeRefreshLayout 的片段布局的根视图,我试着删除空文本和进步观点,并继续到不行。

There's generally a 3 to 6 second delay while refreshing, enough that it's noticeable while watching the log. It should be visible, and it worked fine when I used the now deprecated ActionBar-PullToRefresh library. I've tried making SwipeRefreshLayout the root view of the Fragment layout, and I tried removing the empty text and progress view, and it continues to not work.

有几个步骤,进入我的实际code,我不能透露,因为它是一个应用程序被设计为我的公司。但它只是提供一个类似的基地,许多不同的片段做类似的事情,应该不会影响此的任何功能。

There's a few more steps that go into my actual code that I can't reveal as it's an app being designed for my company. But it's only for providing a similar base to many different fragments that do similar things, it shouldn't affect any functionality for this.

推荐答案

我发现了这个问题,我的应用程序使用半透明UI的Andr​​oid 4.4系统,填充设置列表列表的顶部和底部,以使其在操作栏和导航栏的上方。由于在ListView变成的 SwipeRefreshLayout ,填料应设置的 SwipeRefreshLayout 不是<$ C子$ C>的ListView 就像我一直在我转向使用 SwipeRefreshLayout

I discovered the issue is that my app uses translucent UI on Android 4.4, padding is set to the top of the list and bottom of the list so that it goes under the action bar and above the navigation bar. Since the ListView becomes a child of the SwipeRefreshLayout, the padding should be set to the SwipeRefreshLayout instead of the ListView like I had been before I switched to using SwipeRefreshLayout.

这篇关于SwipeRefreshLayout不显示清爽的任何指示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 20:25