Skip to content

Methods and Attributes

zyyoona7 edited this page Aug 24, 2018 · 4 revisions

WheelView 1.0.0 版方法和属性说明以及默认值

方法名 对应的属性名 说明 默认值
setSoundEffect(boolean isSoundEffect) 设置音效开关 false
setSoundEffectResource(@RawRes int resId) 设置声音效果资源
setPlayVolume(@FloatRange(from = 0.0, to = 1.0) float playVolume) 设置播放音量 当前手机媒体音量
setData(List dataList) 设置数据
setTextSize(float textSize) wv_textSize 设置字体大小 15sp
setTextSize(float textSize, boolean isSp) wv_textSize 设置字体大小 15sp
setAutoFitTextSize(boolean autoFitTextSize) wv_autoFitTextSize 设置是否自动调整字体大小,以显示完全 false
setTypeface(Typeface typeface) 设置当前字体
setTextAlign(@TextAlign int textAlign) wv_textAlign 设置文字对齐方式 TEXT_ALIGN_CENTER
setNormalItemTextColorRes(@ColorRes int textColorRes) wv_normalItemTextColor 设置未选中条目颜色 Color.DKGRAY
setNormalItemTextColor(@ColorInt int textColor) wv_normalItemTextColor 设置未选中条目颜色 Color.DKGRAY
setSelectedItemColorRes(@ColorRes int selectedItemColorRes) wv_selectedItemTextColor 设置选中条目颜色 Color.BLACK
setSelectedItemColor(@ColorInt int selectedItemColor) wv_selectedItemTextColor 设置选中条目颜色 Color.BLACK
setTextBoundaryMargin(float textBoundaryMargin) wv_textBoundaryMargin 设置文字距离边界的外边距 2dp
setTextBoundaryMargin(float textBoundaryMargin, boolean isDp) wv_textBoundaryMargin 设置文字距离边界的外边距 2dp
setLineSpacing(float lineSpacing) wv_lineSpace 设置行间距 2dp
setLineSpacing(float lineSpacing, boolean isDp) wv_lineSpace 设置行间距 2dp
setIntegerNeedFormat(boolean integerNeedFormat) wv_integerNeedFormat 设置数据为Integer类型时是否需要转换 false
setIntegerFormat(String integerFormat) wv_integerFormat 设置Integer类型转换格式 %02d
setVisibleItems(int visibleItems) wv_visibleItems 设置可见的条目数 5
setCyclic(boolean cyclic) wv_cyclic 设置是否循环滚动 true
setCurrentItemPosition(int position) wv_currentItemPosition 设置当前下标 0
setCurrentItemPosition(int position, boolean isSmoothScroll) wv_currentItemPosition 设置当前下标 0
setCurrentItemPosition(int position, boolean isSmoothScroll, int smoothDuration) wv_currentItemPosition 设置当前下标 0
setShowDivider(boolean showDivider) wv_showDivider 设置是否显示分割线 false
setDividerColorRes(@ColorRes int dividerColorRes) wv_dividerColor 设置分割线颜色
setDividerColor(@ColorInt int dividerColor) wv_dividerColor 设置分割线颜色
setDividerHeight(float dividerHeight) wv_dividerHeight 设置分割线高度 1dp
setDividerType(@DividerType int dividerType) wv_dividerType 设置分割线填充类型 DIVIDER_TYPE_FILL
setDividerPaddingForWrap(float dividerPaddingForWrap) wv_dividerPaddingForWrap 设置自适应分割线类型时的分割线内边距 2dp
setDividerCap(Paint.Cap dividerCap) 设置分割线两端形状 Paint.Cap.ROUND
setCurved(boolean isCurved) wv_curved 设置是否是弯曲(3D)效果 true
setCurvedArcDirection(@CurvedArcDirection int curvedArcDirection) wv_curvedArcDirection 设置弯曲(3D)效果左右圆弧效果方向 CURVED_ARC_DIRECTION_CENTER
setCurvedArcDirectionFactor(@FloatRange(from = 0, to = 1.0) float curvedArcDirectionFactor) wv_curvedArcDirectionFactor 设置弯曲(3D)效果左右圆弧偏移效果方向系数 0.75f
setCurvedRefractRatio(@FloatRange(from = 0f, to = 1.0f) float curvedRefractRatio) wv_curvedRefractRatio 设置选中条目折射偏移比例 0.9f
setOnItemSelectedListener(OnItemSelectedListener onItemSelectedListener) 设置选中监听
setOnWheelChangedListener(OnWheelChangedListener onWheelChangedListener) 设置滚动变化监听
Clone this wiki locally