我正在嘗試將ActionBar-PushToRefresh
添加到我的項目中。我已經按照從克里斯巴內斯Github上有說明:Github ActionBar-PullToRefreshActionBar-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
我的看法沒有任何反應。有人能告訴我如何解決它,我知道我錯過了一些東西。謝謝。
謝謝我會看看它。 –
但我仍然想使用ActionBar-PullToRefresh開始一個好的開發,有人可以幫助我嗎? –