GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - iftechio/SquareLayoutManager: 小宇宙 App 广场组件,带惯性运动的二维矩阵卡片列表 UI,自定义 LayoutManager + SnapHelper

BranchesTags
Open more actions menu

Latest commit

 

History

22 Commits
22 Commits

Folders and files

NameName
Last commit message
Last commit date
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
image
image
 
 
library
library
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

SquareLayoutManager

效果图

添加依赖

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add the dependency

dependencies {
      implementation 'io.iftech.android:SquareLayoutManager:<version>'
}

实现原理

小宇宙广场列表实现SquareLayoutManager

基本使用

设置 RecyclerView 的 LayoutManager:

// 构造函数参数 spanCount为一行有多少个 ItemView,startPosition 为起始位置(不传默认中间)
rvSquare.layoutManager = SquareLayoutManager(20, 10)

滑动到指定位置:

layoutManager.smoothScrollToPosition(position) 

是否自动居中:

// 类似 LinearSnapHelper 效果,使用 fling 实现,默认为true
layoutManager.isAutoSelect = true

初始化布局时,是否定位到中心的 item:

// 默认为 true
layoutManager.isInitLayoutCenter = true

设置选中 Item 的监听回调:

layoutManager.setOnItemSelectedListener { postion ->
    Toast.makeText(context, "当前选中:$postion", Toast.LENGTH_SHORT).show()
}

滑动到中心:

layoutManager.smoothScrollToCenter()

About

小宇宙 App 广场组件,带惯性运动的二维矩阵卡片列表 UI,自定义 LayoutManager + SnapHelper

Resources

Readme
Activity
Custom properties

Stars

9 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.