@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.boring_activity_layout); TitleBar titleBar = (TitleBar) findViewById(R.id.boringLayoutTitleBar); titleBar.setTitle("Introduction to MIT"); LinearLayout mRoot = (LinearLayout) findViewById(R.id.boringLayoutRoot); WebView contentView = new WebView(this); contentView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); contentView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); mRoot.addView(contentView); contentView.loadUrl("file:///android_asset/tour/intro_to_mit.html"); }
@Override protected void onCreate(Bundle savedState) { super.onCreate(savedState); setContentView(R.layout.boring_activity_layout); TourHeader header = TourModel.getTour(this).getHeader(); TitleBar titleBar = (TitleBar) findViewById(R.id.boringLayoutTitleBar); titleBar.setTitle(header.getTitle()); LinearLayout rootView = (LinearLayout) findViewById(R.id.boringLayoutRoot); WebView webView = new WebView(this); webView.getSettings().setJavaScriptEnabled(true); HashMap<String, String> content = new HashMap<String, String>(); content.put("BODY-BEFORE-BUTTON", header.getDescriptionTop()); content.put("BODY-AFTER-BUTTON", header.getDescriptionBottom()); String html = StyledContentHTML.populateTemplate(this, "tour/intro_template.html", content); webView.loadDataWithBaseURL(null, html, "text/html", "utf-8", null); rootView.addView(webView); webView.setWebViewClient( new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url.equals("select_start")) { showMap(); } else { CommonActions.viewURL(TourIntroductionActivity.this, url); } return true; } }); }