hellojp / wheelview Goto Github PK
View Code? Open in Web Editor NEWWheelView TimePicker CityPicker 滚轮(联动)选择器
WheelView TimePicker CityPicker 滚轮(联动)选择器
首先感谢作者编写此类库。
发现问题如下:
下滑和上滑选中的项为两个!遍历取选中值时会有区别。
WheelView里面的getSelectedText() 这个方法上滑时 获取到的是上一条数据,下滑的时候正确,如何改正呢
向上滑动时,获取的老是上一个位置的值,向下滑动是正常的
LayoutInflater.from(getContext()).inflate(R.layout.layout_city_picker, this); 这句话应该在onFinishInflate 之前调用吧?
你好,首先感谢你写了个如此好用的控件~
我在使用过程中发现如果延迟加载wheelview布局会排版错乱,后来跟了下源码发现问题是WheelView在onDraw时controlWidth是0,解决的办法是在super.onDraw(canvas);的下边执行添加如下代码:
controlWidth = getWidth();
if (controlWidth == 0) {
invalidate();
return;
}
invalidate();能够重新执行onDraw()方法这样controlWidth 就会被赋值,然后继续后边的绘制,希望对各位有所帮助~
在Touch中加上获取滚动权即可
case MotionEvent.ACTION_MOVE:
if (getParent() != null) {
getParent().requestDisallowInterceptTouchEvent(true);
}
actionMove(y - downY);
onSelectListener();
break;
滚动控件的传入数据和回调出口数据不用接口或者泛型比较失误啊,所有的滚动控件的data应该用泛型或者接口,如果是泛型,指定该泛型应该实现一个接口,这个接口含有getShowText的方法就可以了,用字符串作为传入数据和回调数据,回掉回来还得自己去找对应的model,这个过程是可以在控件封装的时候直接解决的,(String本身就是泛型的一种特殊情况,如果用泛型或者接口,可以很好的适应各种model)
rt
How to set WheelView has cyclic attribute?
不错的库。
希望能补充下这部分的说明。
所以到底怎么用的?
嵌套在ScrollView中的時候,不能滑動。
[email protected]
我再使用WheelView的过程中,出现android 7.0 ui兼容性问题。滚轮中的数据显示不出来。同样的代码在7.0以下能够正常使用
代码片段
布局文件
<com.jp.wheelview.WheelView
app:itemNumber="24"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/hour"
style="@style/wheelViewStyle"
app:lineColor="@color/timeline_color"
app:bottomLineColor="@color/timeline_color"
/>
<View
android:layout_width="@dimen/base20dp"
android:layout_height="match_parent"
android:background="#e7e7e7"
android:visibility="gone"/>
<com.jp.wheelview.WheelView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemNumber="60"
android:id="@+id/minute"
style="@style/wheelViewStyle"
app:lineColor="@color/timeline_color"
app:bottomLineColor="@color/timeline_color"
/>
java代码
mWheelHour = (WheelView) findViewById(R.id.hour);
mWheelMinute = (WheelView) findViewById(R.id.minute);
mWheelHour.setOnSelectListener(mHourListener);
mWheelMinute.setOnSelectListener(mMinuteListener);
mWheelHour.setData(getHourData());
[mWheelMinute.setData(getMinuteData());
setDefault方法不管用,如果只有一条数据不能居中
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.