【问题标题】:Pull To Refresh not showing loading animation拉动刷新不显示加载动画
【发布时间】:2015-01-14 08:25:09
【问题描述】:

我在项目中使用了this pull-to-refresh library,代码如下:

<LinearLayout>

    <TextView
            android:id="@+id/textView1"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:background="@color/transparent"
            android:visibility="invisible" />      

       <com.markupartist.android.widget.PullToRefreshListView     
            android:id="@+id/list_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:cacheColorHint="#00000000"
            android:clipToPadding="false"
            android:divider="@null"
            android:dividerHeight="16dp"
            android:fadingEdge="none"
            android:listSelector="@android:color/transparent"
            android:scrollbarStyle="insideInset"/>
</LinearLayout>

当我看到它运行良好的示例时,它还显示了加载动画视图。

但在我的项目中,使用上面的代码,它没有显示加载动画视图。

listView.setOnRefreshListener(new OnRefreshListener() {

                @Override
                public void onRefresh() {
                    System.out.println("Pull to refresh called");
                    onRefreshClicked(); // To Refresh my list
                    listView.onRefreshComplete();
                }
            });

这有什么问题?

【问题讨论】:

    标签: android listview pull-to-refresh


    【解决方案1】:

    删除你的

    listView.onRefreshComplete();
    

    因为它会在您拉动刷新时停止刷新加载。

    【讨论】:

      【解决方案2】:

      我以前没有使用过那个特定的库,但是你对使用 Android 支持库中的那个有什么反对吗?非常适合我...

      import android.support.v4.widget.SwipeRefreshLayout;
      import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
      

      <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/swipe_container"
          android:layout_width="match_parent"
          android:layout_height="match_parent" >
      
      </android.support.v4.widget.SwipeRefreshLayout>
      

      【讨论】:

      猜你喜欢
      • 2022-01-22
      • 2020-02-09
      • 1970-01-01
      • 2020-05-20
      • 1970-01-01
      • 2018-10-13
      • 2014-10-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多