SwipeRefreshLayout已添加到v19.1.0中的Android支持库: https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html
我现在已经将它添加到我的应用程序中,它的工作方式与广告一样。但是,如果我慢慢滑动,我会注意到过度滚动非常不稳定。观看此视频,了解我的意思: https://www.youtube.com/watch?v=HAuadMZYRf0
我看到使用不同复杂程度的多个布局的问题。上面链接的视频中显示的布局是:
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_refresh_widget"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
相关的Java代码:
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
final View v = inflater.inflate(R.layout.list, container, false);
mSwipeRefreshWidget = (SwipeRefreshLayout) v.findViewById(R.id.swipe_refresh_widget);
mSwipeRefreshWidget.setOnRefreshListener(this);
mSwipeRefreshWidget.setColorScheme(R.color.refresh1, R.color.refresh2, R.color.refresh3,
R.color.refresh4);
// snip
}
任何人都有建议如何解决这个混蛋?无论我花多长时间来超过所需的距离,过度滚动应该是平滑的。谢谢!
答案 0 :(得分:1)
这在support-library v4的20.0版本中已修复。 如果您使用的是gradle:
compile 'com.android.support:support-v4:20.0'