下面列出了android.widget.RelativeLayout#requestLayout ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log_OC.v(TAG, "onCreateView, savedInsanceState is " + savedInstanceState);
// Inflate layout of the dialog
RelativeLayout ssoRootView = (RelativeLayout) inflater.inflate(R.layout.sso_dialog,
container, false); // null parent view because it will go in the dialog layout
if (mSsoWebView == null) {
// initialize the WebView
mSsoWebView = new SsoWebView(getActivity().getApplicationContext());
mSsoWebView.setFocusable(true);
mSsoWebView.setFocusableInTouchMode(true);
mSsoWebView.setClickable(true);
WebSettings webSettings = mSsoWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(false);
webSettings.setLoadWithOverviewMode(false);
webSettings.setSavePassword(false);
webSettings.setUserAgentString(MainApp.getUserAgent());
webSettings.setSaveFormData(false);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.removeAllCookie();
mSsoWebView.loadUrl(mInitialUrl);
}
mWebViewClient.setTargetUrl(mTargetUrl);
mSsoWebView.setWebViewClient(mWebViewClient);
// add the webview into the layout
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT
);
ssoRootView.addView(mSsoWebView, layoutParams);
ssoRootView.requestLayout();
return ssoRootView;
}