我正在尝试将ActionBar-PushToRefresh添加到我的项目中。我遵循了Chris Banes Github的指示:Github ActionBar-PullToRefresh

这是我要启用PullToRefresh功能的视图:

     <uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/ptr_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent">

     <!-- Your content, here we're using a ScrollView -->
     <TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="PULLTOREFRESH THE VIEW"
      android:id="@+id/textView1" />
    <ScrollView
     android:layout_width="match_parent"
     android:layout_height="match_parent">
  </ScrollView>

 </uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout>


这是我的活动以显示视图:

 package com.Test.pulltorefresh;

 import android.app.Activity;
 import android.os.Bundle;
 import uk.co.senab.actionbarpulltorefresh.library.ActionBarPullToRefresh;
 import uk.co.senab.actionbarpulltorefresh.library.Options;
 import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout;


 public class MainActivity extends Activity {
  private PullToRefreshLayout mPullToRefreshLayout;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Now find the PullToRefreshLayout to setup
    mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);

    // Now setup the PullToRefreshLayout
    ActionBarPullToRefresh.from(this)
            // Mark All Children as pullable
            .allChildrenArePullable()
                    // Set the OnRefreshListener
            //.listener(this)
                    // Finally commit the setup to our PullToRefreshLayout
            .setup(mPullToRefreshLayout);
 }
}


当我启动我的应用程序时,我得到了空白视图,但是当我尝试PushToRefresh我的视图时什么也没有发生。有人可以告诉我如何解决它,我知道我错过了一些东西。谢谢。

最佳答案

我可能有点偏偏,但是...
you could consider using this

关于java - ActionBar-PullToRefresh没有任何 react ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22660907/

10-12 06:27