2015年9月2日 星期三

[Android] disable scrolling motion in the listview

reference: http://codetheory.in/android-listview-scrolling-viewgroup-hide-disable-scrollbars/

XML Layout

1
android:scrollbars="none"
android:scrollbars will define which scrollbars to display or show any at all. This won’t disable scrolling as such (you’ll be able to scroll in the appropriate direction) but just hide the scrollbars from the user interface. More of a UI switch.
Programatically, you can call View.setVerticalScrollBarEnabled(boolean) andView.setHorizontalScrollBarEnabled(boolean) for similar effect.

Return true from ListView onTouch event

1
2
3
4
5
6
listView.setOnTouchListener(new View.OnTouchListener() {
 
    public boolean onTouch(View v, MotionEvent event) {
        return (event.getAction() == MotionEvent.ACTION_MOVE);
    }
});

沒有留言:

張貼留言