Reputation: 10856
i am using webiview and i override onTouchEvent than built-in zoom control is not working.
wv.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View arg0, MotionEvent arg1)
{
if(arg1.getAction()==MotionEvent.ACTION_DOWN)
{
x_down = (int) arg1.getX();
y_down = (int) arg1.getY();
Log.v("log", "x pos is "+x_down +"y pos is "+y_down);
}
else if(arg1.getAction()==MotionEvent.ACTION_UP)
{
x_up = (int) arg1.getX();
y_up = (int) arg1.getY();
Log.v("log", "x pos is "+x_up +"y pos is "+y_up);
if((x_down-x_up)>30)
{
wv.loadData("<img src=\"myurl_1\">", "text/html", null);
}
else if((x_up-x_down)>30)
{
wv.loadData("<img src=\"myurl_2\">", "text/html", null);
}
}
return true;
}
});
Thanks in advance...
Upvotes: 0
Views: 923
Reputation: 15973
You are returning always true from the onTouch
method, which means that you are the only one responsible for handling touch events..
you should return true only in the cases you want, and return super.onTouch
in the other cases..
Upvotes: 1
Reputation: 5492
webView.getSettings().setBuiltInZoomControls(true);
add this code to your webview i hope it works
Upvotes: 0