把这两天的心得记录下来,以后用到不会忘。
先说下拉刷新,下拉刷新我们主要用到了android自带v4jar包中的一个控件SwipeRefreshLayout,如果下面是xml文件, 如果你在写报错的话,换一个最新的v4包就可以了。
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/list_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</ListView>
</android.support.v4.widget.SwipeRefreshLayout>
布局文件写好之后就是代码这一块了
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
swipeRefreshLayout.setColorSchemeResources(android.R.color.background_dark, android.R.color.background_li