• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Android-ReboundScrollView: 到顶部还可以继续下拉,头布局可以形成继续放大的效果 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Android-ReboundScrollView

开源软件地址:

https://gitee.com/kikt/Android-ReboundScrollView

开源软件介绍:

#Android-ReboundScrollView

前言

本项目为一个可以在scrollview到顶部后,还可以继续下拉的控件

引用其他第三方类库

'com.nineoldandroids:library:2.4.0' 兼容API9以下的动画库

截图

gif

使用时的核心代码

xml

    <?xml version="1.0" encoding="utf-8"?>    <LinearLayout        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:orientation="vertical"        tools:context="com.kikt.parallax.MainActivity">            <com.kikt.reboundscrollview.ReboundScrollView            android:id="@+id/sv_content"            android:layout_width="match_parent"            android:layout_height="match_parent">                <LinearLayout                android:layout_width="match_parent"                android:layout_height="wrap_content"                android:background="#f0f"                android:orientation="vertical">                    <FrameLayout                    android:id="@+id/fl_head"                    android:layout_width="match_parent"                    android:layout_height="80dp"                    android:background="#f00">                        <ImageButton                        android:layout_width="wrap_content"                        android:layout_height="wrap_content"                        android:layout_gravity="center"                        android:src="@mipmap/ic_launcher"/>                </FrameLayout>                    <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="600dp"                    android:background="#0f0"/>                    <LinearLayout                    android:layout_width="match_parent"                    android:layout_height="600dp"                    android:background="#0ff"/>                </LinearLayout>            </com.kikt.reboundscrollview.ReboundScrollView>        </LinearLayout>

java

    FrameLayout mFlHead;    mSvContent.setHeaderView(mFlHead);//设置需要弹性的头布局    mSvContent.setHeaderView(mFlHead);        mSvContent.setScrollViewListener(new ObservableScrollView.ScrollViewListener() {            @Override            public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy) {            //滚动侦听            }        });    mSvContent.setCloseDuration(300);//关闭动画的速率    mSvContent.setMaxHeight(200);//最大的增加高度    mSvContent.setCanRebound(false);//设定开启弹性功能与否    mSvContent.setOnAnimListener(new ReboundScrollView.OnAnimListener() {//侦听动画        @Override        public void onAnim(ReboundScrollView scrollView, float fraction, float height) {            Log.d("MainActivity", "fraction:" + fraction);//下拉的百分比            Log.d("MainActivity", "height:" + height);//下拉的高度        }    });

关于自定义属性

暂时未加入,后续会考虑加入自定义属性

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap