1 Star 7 Fork 0

赵龙龙 / StickyScrollView

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

StickyScrollView

介绍

粘性ScrollView滚动到顶部指定子View悬浮顶部

Android开发中这样的需求比较多,之前需要写两份布局检测距离后切换展示,比较麻烦且臃肿,使用这个控件只需要把悬浮的控件打个tag即可实现,希望对你有多帮助,有什么好的意见也请多多提出!

样式

图片滑动效果 : 输入图片说明


输入图片说明

接入流程

  • 1.1 在项目build.gradle加入仓库
buildscript {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  • 1.2 在app's build.gradle中添加依赖
dependencies {
  ...
   implementation 'com.gitee.zhaolonglongmayday:sticky-scroll-view:v1.1.1'
}

使用说明

<cn.com.jmw.mylibrary.StickyScrollView 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"
    tools:context=".MainActivity">

  
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">


        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#B55D52" />


        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#366DF1" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:background="@color/white"
            android:gravity="center"
            android:tag="sticky"
            android:text="我是悬浮标题" />

        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#A8A8A8" />


        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#ACACAC" />


        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#D7BB80" />


        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#ff3737" />


        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#E44B46" />


    </LinearLayout>


</cn.com.jmw.mylibrary.StickyScrollView>

划重点 划重点 划重点!!!

需要悬浮的控件添加的tag android:tag="sticky

空文件

简介

粘性ScrollView滚动到顶部指定子View悬浮顶部 展开 收起
Java 等 2 种语言
取消

发行版 (1)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/zhaolonglongmayday/sticky-scroll-view.git
git@gitee.com:zhaolonglongmayday/sticky-scroll-view.git
zhaolonglongmayday
sticky-scroll-view
StickyScrollView
master

搜索帮助