I have a simple app that I wrote for the purposes of learning Java / android coming from the .Net world. In this app I have a ListView. The ListView is bound to a collection and displays everything as it should. I have a next & previous button that allow the user to navigate and these work as well.
What I am wanting to stop is the ability of the user to scroll through the list. I want them to use the navigation buttons. I was thinking there must be some event that is raised when the user scrolls. I was going to intercept that event and just "swallow" it. In looking for those events I came across the SetScrollContainer(false). Problem is that it doesn't seem to matter do anything. I can still scroll vertically
.
So my ultimate question whether by using the SetScrollContainer
or intercepting events or another option is how best to disable user scrolling in a ListView?
I also came across an obscure article saying to implement a custom ListView which sounds like inheritance. I am comfortable with the concept but not sure being so new to android & java
if this complexity is really needed?
TIA JB
Code as discussed in comments below:
//Get a handle on our ListView
lstvw_LiftData = (ListView)findViewById(R.id.lstvw_LiftData);
lstvw_LiftData.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
if (event.getAction() == MotionEvent.ACTION_MOVE)
{
return true; // Indicates that this has been handled by you and will not be forwarded further.
}
return false;
}
}
);