Back to project page userapp-android.
The source code is released under:
MIT License
If you think the Android project userapp-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.userapp.client.android; /*w w w . ja v a 2 s . c o m*/ import android.annotation.SuppressLint; import android.content.Context; import android.webkit.WebSettings; import android.webkit.WebView; import android.widget.FrameLayout; import android.widget.RelativeLayout; public class WebViewRelativeLayout extends RelativeLayout { private WebView webView; @SuppressLint("SetJavaScriptEnabled") public WebViewRelativeLayout(Context context) { super(context); webView = new WebView(context); webView.setId(0X100); webView.setScrollContainer(true); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT); webView.setLayoutParams(params); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); addView(webView); } public WebView getTheWebView() { return webView; } public void loadUrl(String url) { webView.loadUrl(url); } }