Comments (4)
At the beginning the wheel control was designed only for displaying simple
items w/o any control specific features like click events or animation.
It is a base control and of course it does not meet all your expectation :)
But it is possible to extend its functionality according to your needs.
Original comment by [email protected]
on 12 Aug 2011 at 8:25
from android-wheel.
I've observed differences between ListView and your Wheel sources with respect
to handling onTouch events (and applying them to children items) and coundn't
find out how to 'fix' wheel.
What exactly I need to change to get desirable functionality?
Thank you.
Original comment by [email protected]
on 12 Aug 2011 at 8:59
from android-wheel.
I'll investigate and let you know.
Thank you
Original comment by [email protected]
on 12 Aug 2011 at 9:09
from android-wheel.
To allow clicks on the current item look for the onTouchEvent method in
WheelView and replace the line:
if (items != 0 && isValidItemIndex(currentItem + items)) {
with:
if (isValidItemIndex(currentItem + items)) {
or if you want to allow ONLY clicks on the current item:
if (items == 0 && isValidItemIndex(currentItem)) {
Unfortunately even a 1 pixel movement with cause a scroll instead of a click.
You might have to tweak the scrolling mechanism to consider a scroll < 10
pixels (or something) a click too. For example by creating a member and
constant:
protected int scrolledDistance;
private static final int MIN_DELTA_FOR_CLICKING = 25;
in WheelView and replacing the scrolling listener code with:
// Scrolling listener
WheelScroller.ScrollingListener scrollingListener = new WheelScroller.ScrollingListener() {
public void onStarted() {
isScrollingPerformed = false;
scrolledDistance = 0;
notifyScrollingListenersAboutStart();
}
public void onScroll(int distance) {
doScroll(distance);
scrolledDistance += Math.abs(distance);
if (scrolledDistance > MIN_DELTA_FOR_CLICKING) {
isScrollingPerformed = true;
}
int height = getHeight();
if (scrollingOffset > height) {
scrollingOffset = height;
scroller.stopScrolling();
} else if (scrollingOffset < -height) {
scrollingOffset = -height;
scroller.stopScrolling();
}
}
public void onFinished() {
notifyScrollingListenersAboutEnd();
scrollingOffset = 0;
invalidate();
}
public void onJustify() {
if (Math.abs(scrollingOffset) > WheelScroller.MIN_DELTA_FOR_SCROLLING) {
scroller.scroll(scrollingOffset, 0);
}
}
};
Original comment by [email protected]
on 9 Nov 2011 at 11:07
from android-wheel.
Related Issues (20)
- smothness
- setLable function
- Handler class should be static or leaks might occur (Android Lint)
- how to increase scroll time when we use setCurrentItem(value,true)? HOT 1
- Binary XML file line #44: Error inflating class kankan.wheel.widget.WheelView HOT 3
- How to make wheel always win
- java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap HOT 1
- Some changes I made while using your control
- make in horozontal
- Single item animation HOT 3
- Issue #5 is not fixed HOT 2
- Highlight selected Item HOT 4
- Android-Wheel ListView
- Wheelview width not filling parent
- Using the choosen value
- wheels.addClickingListener not fire
- transform into fragment
- How can i implement ?
- Images space doesn't maintain in fairways wheel
- How can i shift the position of selected item upside.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-wheel.