liaoinstan / SpringView

🔥 A custom view pull to refresh,support ScrollView,ListView,RecyclerView,WebView and all another views, easy to use
Apache License 2.0
1.93k stars 355 forks source link

SpringView.callFresh()方法无效? #58

Open youyuanme opened 7 years ago

youyuanme commented 7 years ago

SpringView.callFresh()方法无效? 需求是想在进入activity时自动显示下拉刷新,并且可以回调下面的onRefresh()方法。 mSpringView.setListener(new SpringView.OnFreshListener() { @Override public void onRefresh() { } @Override public void onLoadmore() { } });

liaoinstan commented 7 years ago

你一定是在onCreate方法里调用的吧,Activity在onCreate的时候View是不能执行动画的,一定要在onCreate中调用就加个延时吧 new Handler().postDelayed(new Runnable() { @Override public void run() { springView.callFresh(); } },100);

youyuanme commented 7 years ago

onResume()方法中可以执行view动画吗?

krmao commented 6 years ago

just use it , no thanks !!!

override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        Looper.myQueue().addIdleHandler {
                spring_view.callFresh()
                false
        }

}
ycyz97 commented 6 years ago

我也遇到了,并不是在onCreate中调用的,加延时也没用

Itachi6688 commented 5 years ago

我也遇到了,并不是在onCreate中调用的,加延时也没用

延时没加够,不然就是代码问题