Logo Icon Logo
A Crowd-sourced Cookbook on Writing Great Android® Apps
GitHub logo Twitter logo OReilly Book Cover Art

Prevent flickering when user performs scrolling on a view

Published? false
FormatLanguage: WikiFormat


How annoying is it when you have created a view only to find screen flicking causes the display to flick vertically before being readjusted


Implement your Activity and override the OnTouchListener method such

public class TestActivity extends Activity implements OnTouchListener

then override the method below


public boolean onTouch(View aView, MotionEvent aEvent)
   if(aEvent.getAction() == MotionEvent.ACTION_MOVE)
           return true; 
   return false; 


The implementation capture the flick up/down event and prevents it being handled by the base activity classes. causing the view to be static as required