• PullToRefreshView的样式以及一些问题


    首先说  PulltorefreshListView  PullToRefreshGridView  PullToRefreshWebView PullToRefreshScrollView PullToRefreshExpandableListView  PullToRefreshHorizontalScrollView PullToRefreshBase  PullToRefreshAdapterViewBase 一共有这么多样式

    pulltoRefreshView 添加n个headView那么它被点击的项的position值就会比真实的多n+1(真实测试值)

    这里真实的值是指适配器中数据的索引(0,1,2,3,4,。。。。)

    在fragment中添加点击事件时listView.setAdapter一定是在最后更新否则前边更新的都会无效 

    此处的例子是pulltorefreshlistview 切换适配器时的例子(点击不同的区域更新适配器)

      @Override
        public void onClick(View v) {
            switch (v.getId())
            {
                case R.id.linear_zuire_huodongfragment:
    
                     tv_zuire.setTextColor(Color.BLUE);
                    line_zuire.setBackgroundColor(Color.BLUE);
                    tv_zuixin.setTextColor(Color.BLACK);
                    line_zuixin.setBackgroundColor(Color.parseColor("#42050206"));
    
                    listView.setAdapter(hotAdapter);//-------------------------此处更新适配器一定要在最后更新否则前边的ui操作无效
                    break;
                case R.id.linear_zuixin_huodongfragment:
    
                    tv_zuire.setTextColor(Color.BLACK);
                    line_zuire.setBackgroundColor(Color.parseColor("#42050206"));
                    tv_zuixin.setTextColor(Color.BLUE);
                    line_zuixin.setBackgroundColor(Color.BLUE);
    
                    listView.setAdapter(newAdapter);//-------------------------此处更新适配器一定要在最后更新否则前边的ui操作无效
                    break;
            }
        }





    设置上啦加载 下拉刷新的布局

      private void setPullDownLayout() {
            SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
            //获取下啦布局
            ILoadingLayout proxy=listView.getLoadingLayoutProxy(true,false);//true,false  意思是下拉时的布局
            proxy.setPullLabel("下拉刷新");
            proxy.setReleaseLabel("放开以刷新。。。");
            proxy.setRefreshingLabel("玩命刷新。。。");
            proxy.setLastUpdatedLabel("最后刷新时间:"+format.format(new Date()));
            //设置上啦加载的布局
            /*ILoadingLayout proxy2=listView.getLoadingLayoutProxy(false,true);  //false true 意思是上拉时的布局
            proxy2.setPullLabel("请上拉加载");
            proxy2.setReleaseLabel("放开以加载。。。");
            proxy2.setRefreshingLabel("玩命加载。。。");
            proxy2.setLastUpdatedLabel("最后加载时间:"+format.format(new Date()));*/
        }
    <?xml version="1.0" encoding="utf-8"?>  
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
        android:layout_width="match_parent"  
        android:layout_height="match_parent"  
        android:orientation="vertical" >  
          
        <!--     ptr:ptrAnimationStyle="flip"  flip:翻转  rotate:旋转-->  
        <!--     ptr:ptrShowIndicator="true"  右上角 右下角出现箭头-->  
        <com.handmark.pulltorefresh.library.PullToRefreshListView  
            xmlns:ptr="http://schemas.android.com/apk/res-auto"  
            android:id="@+id/pullToRefresh"  
            android:layout_width="match_parent"  
            android:layout_height="wrap_content"  
            ptr:ptrDrawable="@drawable/default_ptr_flip"   
            ptr:ptrAnimationStyle="flip"  //这个样式反转后会变为圆形 
            ptr:ptrHeaderBackground="#383838"  
            ptr:ptrHeaderTextColor="#FFFFFF"  
            />  
      
    </LinearLayout>  
  • 相关阅读:
    网络通信之 字节序转换原理与网络字节序、大端和小端模式
    [C/C++]大小端字节序转换程序
    面向对象和面向过程的区别
    编译libjpeg
    地形系统lod
    c/c++ 代码中使用sse指令集加速
    个人作品- 蘑菇大战
    个人作品- 几何战争
    Obj格式模型 读取
    各大引擎矩阵的矩阵存储方式 ----行矩阵 or 列矩阵
  • 原文地址:https://www.cnblogs.com/bimingcong/p/4959118.html
Copyright © 2020-2023  润新知