Code example for WebView

Methods: getSettingssetLayoutParams, setOnTouchListener

0
				showCaption(); 
			} 
		}); 
		this.addView(mCaptionButton);
 
		mCaptionWebView = new WebView(getContext());
		{ 
			final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
			mCaptionWebView.setLayoutParams(params);
		} 
		mCaptionWebView.getSettings().setJavaScriptEnabled(true);
		final GestureDetector g = new GestureDetector(new OnGestureListener(){
 
			@Override 
			public boolean onDown(MotionEvent arg0) {
				return false; 
			} 
 
			@Override 
			public boolean onFling(MotionEvent e1, MotionEvent e2, float arg2, float arg3) {
				if (e1.getY() < e2.getY()) { // Fling down
					if (mCaptionWebView.getScrollY() == 0) {
						hideCaption(); 
						return true; 
					} 
				} 
				return false; 
			} 
 
			@Override 
			public void onLongPress(MotionEvent arg0) {				
			} 
 
			@Override 
			public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) {
				return false; 
			} 
 
			@Override 
			public void onShowPress(MotionEvent arg0) {
			} 
 
			@Override 
			public boolean onSingleTapUp(MotionEvent arg0) {
				hideCaption(); 
				return true; 
			}}); 
		mCaptionWebView.setOnTouchListener(new View.OnTouchListener() {
				 
				@Override 
				public boolean onTouch(View arg0, MotionEvent arg1) {
					return g.onTouchEvent(arg1);
				} 
Connect your IDE to all the code out there  Get Codota for Java