Coder Social home page Coder Social logo

fanlayout's Introduction

可定制性超强的圆弧滑动组件

使用方式:

添加依赖:

implementation 'com.wuyr:fanlayout:1.0.1'

APIs:

Method Description
setAutoSelect(boolean isAutoSelect) 设置滚动完毕是否自动选中最近的Item
setBearingCanRoll(boolean isCanRoll) 设置轴承是否可以跟随Item旋转
BearingTypeTYPE_VIEW时有效
setBearingColor(int color) 设置轴承颜色
BearingTypeTYPE_COLOR时有效
setBearingLayoutId(int layoutId) 指定轴承的布局id
BearingTypeTYPE_VIEW时需设置
setBearingOffset(int offset) 设置轴承的偏移量
setBearingOnBottom(boolean isOnBottom) 设置轴承是否在底部
setBearingType(int type) 设置轴承类型
setFixingAnimationDuration(int duration) 设置惯性滚动后,自动选中的动画时长
setGravity(int gravity) 设置对齐方式
setItemAddDirection(int direction) 设置Item的添加方向 默认: 顺时针添加
setItemAngleOffset(float angle) 指定Item的偏移角度
LayoutModeMODE_FIXED时有效
setItemDirectionFixed(boolean isFixed) 设置item是否保持垂直
setItemLayoutMode(int layoutMode) item的布局方式: 默认: MODE_AVERAGE(平均)
如设置为MODE_FIXED需指定偏移的角度:
setItemAngleOffset(float angle)
setItemOffset(int itemOffset) 设置Item的偏移量
setRadius(int radius) 指定轴承半径
BearingTypeTYPE_COLOR时有效
setScrollAvailabilityRatio(float ratio) 惯性滚动利用率
数值越大,惯性滚动的动画时间越长
setSelection(int index, boolean isSmooth) 选中指定的Item
setOnItemRotateListener(Listener listener) 设置旋转事件监听
setOnItemSelectedListener(Listener listener) 设置自动选中监听
setOnBearingClickListener(Listener listener) 设置轴承点击监听
setOnItemClickListener(Listener listener) 设置items点击监听
setOnItemLongClickListener(Listener listener) 设置items长按监听

Attributes:

Name Format Description
auto_select boolean (默认: false) 滚动完毕是否自动选中最近的Item
bearing_can_roll boolean (默认: false) 轴承是否跟随Item转动
bearing_color color (默认: #000000) 轴承颜色
bearing_typecolor时才有效
bearing_gravity enum (默认: left)
top(顶部)
bottom(底部)
left(左边)
left_top(左上)
left_bottom(左下)
right(右边)
right_top(右上)
right_bottom(右下)
对齐方式
bearing_layout reference 自定义的轴承布局
bearing_typeview时才有效
bearing_offset dimension 轴承偏移量
bearing_on_bottom boolean (默认: false) 轴承是否在底部
bearing_radius dimension 轴承半径
bearing_type enum (默认: color)
view
color
轴承类型
设置为view时需指定bearing_layout
item_add_direction enum (默认: clockwise)
clockwise(顺时针)
counterclockwise(逆时针)
interlaced(交叉)
item的添加方向
item_angle_offset float 固定的偏移角度
item_layout_modefixed时有效
item_direction_fixed boolean (默认: false) Item是否保持垂直
item_layout_mode enum (默认: average)
average(平均分配)
fixed(指定角度)
item的布局方式
设置为fixed时需指定item_angle_offset
item_offset dimension item偏移量

Demo下载: app-debug.apk

几行代码实现Android弧形滑动 (圆弧滑动辅助) https://github.com/Ifxcyr/ArcSlidingHelper

效果图 (表情包来源:百度贴吧):

preview preview preview preview preview preview preview preview preview preview

fanlayout's People

Contributors

wuyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.