最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

android組件SwipeRefreshLayout下拉小球式刷新效果

 更新時間:2017年02月17日 17:56:16   作者:Android丶Ren  
這篇文章主要為大家詳細(xì)介紹了android組件SwipeRefreshLayout下拉小球式刷新效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下

swiperefreshlayout實現(xiàn)下拉小球式的刷新,供大家參考,具體內(nèi)容如下

布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

  <android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/swipeRefreshLayout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
  >
   <ListView
     android:id="@+id/listView"
     android:layout_width="match_parent"
     android:layout_height="wrap_content">
   </ListView>
  </android.support.v4.widget.SwipeRefreshLayout>

</RelativeLayout>

MainActivity:

public class MainActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener{

private static final int REFRESH_STATUS =0;
private ListView myListView;
private SwipeRefreshLayout mySwipeRefreshLayout;
private ArrayAdapter<String> listAdapter;
private List<String> listIDE = new ArrayList<String>(Arrays.asList("Visual Studio", "Android Studio", "Eclipse", "Xcode"));
private Handler refreshHandler = new Handler()
{
  public void handleMessage(android.os.Message msg)
  {
    switch (msg.what)
    {
      case REFRESH_STATUS:
        listIDE.removeAll(listIDE);
        listIDE.addAll(Arrays.asList("C#", "Java", "C++","Object-C"));
        listAdapter.notifyDataSetChanged();
        mySwipeRefreshLayout.setRefreshing(false);
        break;

    }
  };
};
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  myListView = (ListView) findViewById(R.id.listView);
  mySwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout);

  mySwipeRefreshLayout.setOnRefreshListener(this);
  mySwipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light,
      android.R.color.holo_orange_light, android.R.color.holo_red_light);
  listAdapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,listIDE);
  myListView.setAdapter(listAdapter);
}

@Override
public void onRefresh() {
  refreshHandler.sendEmptyMessageDelayed(REFRESH_STATUS, 1500);
 }
}

效果圖:

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論

永宁县| 锡林浩特市| 阿合奇县| 舒城县| 定陶县| 马山县| 盐山县| 来凤县| 淮安市| 江津市| 甘肃省| 涪陵区| 南昌县| 翁源县| 永登县| 仙桃市| 八宿县| 犍为县| 望城县| 寿光市| 新乡市| 金门县| 新余市| 龙岩市| 读书| 杂多县| 昆明市| 德昌县| 三门县| 滁州市| 海林市| 德令哈市| 司法| 古丈县| 阿尔山市| 惠来县| 浑源县| 临潭县| 太原市| 凤阳县| 青河县|