Code example for RelativeLayout

Methods: setGravity, addView

0
					RelativeLayout.LayoutParams.FILL_PARENT );
 
 
	//TODO: Configuration option to hide zoom controls 
	public static View getView(final Context c, String url) {
		final RelativeLayout rl = new RelativeLayout(c);
		rl.setGravity(Gravity.CENTER);
 
 
		final WebView wv = new WebView(c);
		wv.setLayoutParams(lp);
		wv.getSettings().setJavaScriptEnabled(true);
		wv.getSettings().setBuiltInZoomControls(true);
		wv.getSettings().setDisplayZoomControls(true);
		wv.setDrawingCacheEnabled(true);
		wv.setAnimationCacheEnabled(true);
		wv.loadUrl(url);
		wv.setVisibility(View.GONE);
 
		final ProgressBar pb = new ProgressBar(c);
 
		rl.addView(wv);
		rl.addView(pb,30,30);
 
		wv.setWebViewClient(new WebViewClient(){
			@Override 
			public void onPageFinished(WebView view, String url) {
				//Remove progress bar 
Experience pair programming with AI  Get Codota for Java