gpt4 book ai didi

java - ActionBar-PullToRefresh 没有任何反应

转载 作者:太空宇宙 更新时间:2023-11-04 15:00:13 26 4
gpt4 key购买 nike

我正在尝试将 ActionBar-PushToRefresh 添加到我的项目中。我按照 Chris Banes Github 的说明进行操作:Github ActionBar-PullToRefresh

这是我想要启用 PullToRefresh 功能的 View :

     <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>

这是我显示 View 的 Activity :

 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);
}
}

当我启动应用程序时,我得到了空白 View ,但当我尝试PushToRefresh我的 View 时没有任何反应。有人可以告诉我如何解决它,我知道我错过了一些东西。谢谢。

最佳答案

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

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com