SMALL

WebView 에서 가로 스크롤

 

m_webView.setHorizontalScrollBarEnabled(false);
        m_webView
.setOnTouchListener(new View.OnTouchListener() {
           
public boolean onTouch(View v, MotionEvent event) {

               
switch (event.getAction()) {
               
case MotionEvent.ACTION_DOWN: {
                   
// save the x
                    m_downX
= event.getX();
               
}
                   
break;

               
case MotionEvent.ACTION_MOVE:
               
case MotionEvent.ACTION_CANCEL:
               
case MotionEvent.ACTION_UP: {
                   
// set x so that it doesn't move
                   
event.setLocation(m_downX, event.getY());
               
}
                   
break;

               
}

               
return false;
           
}
       
});

 

일반적으로 터치이벤트를 중간에 가로채는 것은 허용되지 않지만 위와 같은 코드로 스크롤을 막을 수 있다.

 

LIST