zoukankan      html  css  js  c++  java
  • Andorid 刷新样式一

    一、Gradle中的Build.gradle依赖项目

     compile 'com.github.moduth:blockcanary-android:1.1.0'
        debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
        releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
        testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
        //inspection GradleCompatible
        compile 'com.android.support:design:22.2.0'
        compile 'com.jakewharton:butterknife:8.4.0'
        annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'

    2、app中的Build.gradle依赖管理

    classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'

    3、布局文件

     <com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/home_tab_rGroup"
                android:id="@+id/recommend_parent"
                >
                <ListView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/recommend"
                    />
            </com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout>

    4、代码

     private void refresh(View view,int id){
            TwinklingRefreshLayout refreshLayout = (TwinklingRefreshLayout) view.findViewById(id);
            ProgressLayout header = new ProgressLayout(getActivity());
            refreshLayout.setHeaderView(header);
            refreshLayout.setFloatRefresh(true);
            refreshLayout.setOverScrollRefreshShow(false);
            refreshLayout.setHeaderHeight(140);
            refreshLayout.setMaxHeadHeight(240);
            refreshLayout.setOverScrollHeight(200);
            refreshLayout.setEnableLoadmore(false);
            header.setColorSchemeResources(R.color.Blue, R.color.Orange, R.color.Yellow, R.color.Green);
    
            refreshLayout.startRefresh();
            refreshLayout.setOnRefreshListener(new RefreshListenerAdapter() {
                @Override
                public void onRefresh(final TwinklingRefreshLayout refreshLayout) {
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            refreshLayout.finishRefreshing();
                        }
                    }, 4000);
                }
            });
    
        }
  • 相关阅读:
    pyinstaller安装和使用
    django项目结构和运行项目
    安装django and 创建项目
    浅谈网络请求基础(理论篇)
    浅谈爬虫初识
    判断是否AVL平衡二叉书
    用递归方法判断两棵树是否相等
    广度优先搜索求树的深度
    堆排序
    归并排序
  • 原文地址:https://www.cnblogs.com/QQ862668193/p/8080731.html
Copyright © 2011-2022 走看看