zoukankan      html  css  js  c++  java
  • 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>  
  • 相关阅读:
    【设置图片主体部分居中】
    高效数据查询设计思想
    SpringBoot中的classpath
    mysql优化口诀
    windows安装kafka
    windows安装rabbitmq
    使用Charles在移动端抓包
    07 哨兵机制:主库挂了,如何不间断服务
    操作系统(一)操作系统历史:从标准函数库到云计算
    06 数据同步:主从库如何实现数据一致
  • 原文地址:https://www.cnblogs.com/bimingcong/p/4959118.html
Copyright © 2011-2022 走看看