类 WheelView

    • 构造器详细资料

      • WheelView

        public WheelView​(Context context,
                         AttributeSet attrs,
                         int defStyle)
        Constructor
      • WheelView

        public WheelView​(Context context)
        Constructor
    • 方法详细资料

      • setConfig

        public void setConfig​(PickerConfig config)
      • setInterpolator

        public void setInterpolator​(Interpolator interpolator)
        Set the the specified scrolling interpolator
        参数:
        interpolator - the interpolator
      • getVisibleItems

        public int getVisibleItems()
        Gets count of visible items
        返回:
        the count of visible items
      • setVisibleItems

        public void setVisibleItems​(int count)
        Sets the desired count of visible items. Actual amount of visible items depends on wheel layout parameters. To apply changes and rebuild view call measure().
        参数:
        count - the desired count for visible items
      • getViewAdapter

        public WheelViewAdapter getViewAdapter()
        Gets view adapter
        返回:
        the view adapter
      • setViewAdapter

        public void setViewAdapter​(WheelViewAdapter viewAdapter)
        Sets view adapter. Usually new adapters contain different views, so it needs to rebuild view by calling measure().
        参数:
        viewAdapter - the view adapter
      • addChangingListener

        public void addChangingListener​(OnWheelChangedListener listener)
        Adds wheel changing listener
        参数:
        listener - the listener
      • removeChangingListener

        public void removeChangingListener​(OnWheelChangedListener listener)
        Removes wheel changing listener
        参数:
        listener - the listener
      • notifyChangingListeners

        protected void notifyChangingListeners​(int oldValue,
                                               int newValue)
        Notifies changing listeners
        参数:
        oldValue - the old wheel value
        newValue - the new wheel value
      • addScrollingListener

        public void addScrollingListener​(OnWheelScrollListener listener)
        Adds wheel scrolling listener
        参数:
        listener - the listener
      • removeScrollingListener

        public void removeScrollingListener​(OnWheelScrollListener listener)
        Removes wheel scrolling listener
        参数:
        listener - the listener
      • notifyScrollingListenersAboutStart

        protected void notifyScrollingListenersAboutStart()
        Notifies listeners about starting scrolling
      • notifyScrollingListenersAboutEnd

        protected void notifyScrollingListenersAboutEnd()
        Notifies listeners about ending scrolling
      • addClickingListener

        public void addClickingListener​(OnWheelClickedListener listener)
        Adds wheel clicking listener
        参数:
        listener - the listener
      • removeClickingListener

        public void removeClickingListener​(OnWheelClickedListener listener)
        Removes wheel clicking listener
        参数:
        listener - the listener
      • notifyClickListenersAboutClick

        protected void notifyClickListenersAboutClick​(int item)
        Notifies listeners about clicking
      • getCurrentItem

        public int getCurrentItem()
        Gets current value
        返回:
        the current value
      • setCurrentItem

        public void setCurrentItem​(int index)
        Sets the current item w/o animation. Does nothing when index is wrong.
        参数:
        index - the item index
      • setCurrentItem

        public void setCurrentItem​(int index,
                                   boolean animated)
        Sets the current item. Does nothing when index is wrong.
        参数:
        index - the item index
        animated - the animation flag
      • isCyclic

        public boolean isCyclic()
        Tests if wheel is cyclic. That means before the 1st item there is shown the last one
        返回:
        true if wheel is cyclic
      • setCyclic

        public void setCyclic​(boolean isCyclic)
        Set wheel cyclic flag
        参数:
        isCyclic - the flag to set
      • invalidateWheel

        public void invalidateWheel​(boolean clearCaches)
        Invalidates wheel
        参数:
        clearCaches - if true then cached views will be clear
      • onMeasure

        protected void onMeasure​(int widthMeasureSpec,
                                 int heightMeasureSpec)
        覆盖:
        onMeasure 在类中 View
      • onLayout

        protected void onLayout​(boolean changed,
                                int l,
                                int t,
                                int r,
                                int b)
        覆盖:
        onLayout 在类中 View
      • onDraw

        protected void onDraw​(Canvas canvas)
        覆盖:
        onDraw 在类中 View
      • scroll

        public void scroll​(int itemsToScroll,
                           int time)
        Scroll the wheel
        参数:
        itemsToScroll - items to scroll
        time - scrolling duration
      • stopScrolling

        public void stopScrolling()
        Stops scrolling