Code Monkey home page Code Monkey logo

wheelview's Introduction

#WheelView 滚轮控件 WheelView仿IOS的滑动选择器

  • 继承自View,绘制所有的显示。
  • 监听手势来移动(根据新坐标重新绘制)itemObject。
  • 单个控件(一个类实现了滚轮效果),拓展性较强。

这里说明一下的是WheelView只能实现一个滚轮,联动效果 可通过多个WheelView的组合使用(issues里面有人反馈这个问题😂)

###效果图:

  • CityPicker

cityPicker

  • TimePicker

timePicker

###坐标图

下图为控件中心位置的itemObject居中时的简易坐标图。

item_coordinate

在布局中放入WheelView控件

<me.jp.wheelview.view.WheelView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:itemNumber="6"
    app:lineColor="#ff5789DC"
    app:maskHeight="32dp"
    app:noEmpty="true"
    app:normalTextColor="#777"
    app:normalTextSize="14sp"
    app:selectedTextColor="#ff000000"
    app:selectedTextSize="22sp"
    app:unitHeight="50dp"
    />

Attributes

There are several attributes you can set:

attr 属性 description 描述
lineColor divider line color 分割线颜色
lineHeight divider line height 分割线高度
itemNumber wheelview show item count 此wheelView显示item的个数
maskHeight mask height 蒙版高度(normalText的位置)
noEmpty if set true select area can't be null(empty),or could be empty 设置true则选中不能为空,否则可以是空
normalTextColor unSelected Text color 未选中文本颜色
normalTextSize unSelected Text size 未选中文本字体大小
selectedTextColor selected Text color 选中文本颜色
selectedTextSize selected Text size 选中文本字体大小
unitHeight item unit height 每个item单元的高度

#Method ###1. setData(ArrayList data) set WheelView data
设置WheelView的数据

###2. refreshData(ArrayList data) refresh WheelView data ,and draw again
刷新 WheelView的数据,并重绘

###3. int getSelected() get selected item index
获取选中项的index

###4. String getSelectedText() get selected item text
获取选中项的文本信息

###5. boolean isScrolling is WheelView is scrolling
获取WheelView是否在滚动中

###6. boolean isEnable() is WheelView is enable
获取wheelView是否可用

###7. void setEnable(boolean isEnable)
set WheelView enable
设置WheelView是否可用

###8. void setDefault(int index) set default selected index
设置默认选中项的index

###9. int getListSize() get WheelView item count
获取WheelView的item项个数

###10. String getItemText(int index) get the text by index
获取index位置上的文本数据

###11. void setOnSelectListener(OnSelectListener onSelectListener) set listener on WheelView that can get info when WheelView is scrolling or stop scroll.
对WheelView设置监听,在 滑动过程 或者 滑动停止 返回数据信息。

wheelview's People

Contributors

hellojp avatar haibinpark avatar

Watchers

xiaowei 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.