【问题标题】:My webview customhtml background onitemclicklistener我的 webview customhtml 背景 onitemclicklistener
【发布时间】:2014-12-16 20:36:44
【问题描述】:

您好,我已经尝试了很多教程并检查了 stackoverflow,但我遇到了问题。自定义 html webview 不会自动查看,您必须单击 android 手机的后退按钮,然后他才能查看他。 有人可以帮忙吗?

webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setSupportZoom(true);
webView.setBackgroundColor(Color.parseColor("#9e1b32"));

   String customHtml = "<html><body><h1>Hello, WebView</h1></body></html>";
   webView.loadData(customHtml, "text/html", "UTF-8");

和列表视图换页器:

  public void onItemClick(AdapterView<?> parent, View view,
      int position, long id) {
      switch (position) 
      {
        case 0:
         Intent newActivity0 = new Intent(getBaseContext(), 1.class);     
         startActivity(newActivity0);

    case 1:
     Intent newActivity1 = new Intent(getBaseContext(), 2.class);     
     startActivity(newActivity1);

  }

【问题讨论】:

    标签: java android xml webview


    【解决方案1】:

    它现在适用于: 您必须添加休息时间;在startactivity下 public void onItemClick(AdapterView parent, View view,

    int 位置,长 id) { 开关(位置) { 案例0: Intent newActivity0 = new Intent(getBaseContext(), 1.class);
    开始活动(新活动0); 休息; 情况1: 意图 newActivity1 = new Intent(getBaseContext(), 2.class);
    开始活动(新活动1); 休息;

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-10
      • 2016-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多