6


androidのwebviewのおかげで表示されるhtmlアセットがあります。現在のブラウザではうまく表示されますが、Android 2.1などの古いブラウザでは、画像に表示されているとおりになります。

私のアプリの最初の画像失敗


誰かが見たいと思った場合に備えて、コードを入れました。
HTML

 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Documento sin título</title>
    <script>
        function show(divactual,textactual) {
            if(document.getElementById(divactual).style.display == "block"){
                document.getElementById(divactual).style.display = "none";
                document.getElementById(textactual).innerHTML = "show details...";

                }
            else if(document.getElementById(divactual).style.display == "none"){
                document.getElementById(divactual).style.display = "block";
                document.getElementById(textactual).innerHTML = "hidden details...";
                }
        }
    </script>   
    <style type="text/css">
        body{
            background-color:transparent;
            font-family: Verdana, Geneva, sans-serif;
            font-size: 1.0em;
            font-style: normal;
            color:#999999;
            margin:10px;
        }
        body a{
            color:#0CF;
            text-decoration:none;
        }
        #bg {
            z-index: -14;
            width: 100%;
        }
        #letrapequena {
            font-family: Verdana, Geneva, sans-serif;
            font-size: 0.6em;
            color: #00537c;
        }
        #tituloseccion{
            font-family: Verdana, Geneva, sans-serif;
            font-size: 1.5em;
            font-style: normal;
            font-weight: bold;
            color:#7AB800;
        }
        #headtwo{
            font-family: Verdana, Geneva, sans-serif;
            font-size: 1.2em;
            font-style: normal;
            font-weight: bold;
            color:#7AB800;
        }
        #headthree{
            font-size: 1.1em;
            font-style: normal;
            font-weight:bold;
            color:#00537C;
        }
        #container{
            background-color:#D8F7FE;
            margin:10px 0;
            color:#00537c;
            font-weight:bold;
        }
    </style>
  </head>
  <body style="background-color:transparent;">
    <div id="tituloseccion">
        Titleone
    </div>
    <hr align="left" width="90%" size="0.1em" color="#999999">
    <div id="headtwo">titletwo</div>
    <div id="bigcontainer" style="display:block;">
        <div id="headthree">titlethree</div>
        <div id="generalcont" style="display:block;">
            <div id="container" style="display:block;">
                <div style="display:inline">parrone&nbsp;&nbsp;&nbsp;</div>
                <div style="display:inline;">
                    <a href="javascript:show('info1','text1');" id="text1">show datails...</a>
                </div>
            </div>
            <div  id="info1" style="display:none;" >
                text text text text text text text text 
            </div>
         </div>

        <div id="generalcont" style="display:block;">
            <div id="container" style="display:block;">
                <div style="display:inline">parrtwo&nbsp;&nbsp;&nbsp;&nbsp;</div>
                <div style="display:inline;">
                    <a href="javascript:show('info2','text2');" id="text2">show details...</a>
                </div>
            </div>
            <div  id="info2" style="display:none;" >
                text text text text text text text 
            </div>
        </div>
    </div>
    <div id="letrapequena" style="display:block;">
                text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 
            </div>
  </body>
</html>


JAVA

 package es.ibys.prueba.webview;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.webkit.WebView;

public class PruebawebviewActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        WebView myWview = (WebView) findViewById(R.id.webview);

        String miurl = "file:///android_asset/index2.htm";
        myWview.getSettings().setJavaScriptEnabled(true);
        myWview.setBackgroundColor(Color.TRANSPARENT);
        myWview.loadUrl(miurl);
    }
}


修正方法がわかりません。私はlayer、css、div、stylesを変更しようとしました...私に起こったすべてのもの。誰かが起こったのですか?どのように管理しましたか?助けてください

4

1 に答える 1

0

これはあなたの JS の問題ではありませんか?

ここにあなたのコードのフィドルがあります:http://jsfiddle.net/8wsvu/

純粋な JS の関数は Android 関数ですかshow()、それとも JS であるはずですか? 私はまだJSでそれがそうであるかどうかを知るのに十分ではありませんが、それをグーグルで検索しても、JS関数であるという結果は得られませんでした。

レイヤーが間違っている理由についての私の2番目の推測は、divが互いに絶対に配置されているためです。

ページ上の要素の表示と非表示に jQuery を使用できる場合、これははるかに簡単になります。

于 2012-06-18T14:06:26.583 に答える