2

トランプが表示されるクロムを使用してhtmlファイルをロードすると、トランプの画像を表示するだけの単純なcssファイルを含む単純なhtmlファイルがあります。ただし、WebView を使用して同じ html ファイルを読み込むと、画像がありません。背景色を設定するだけで問題なく動作するため、html と css が正しく読み込まれて動作するため、問題は画像の URL にあると想定しています。足りないものはありますか?

ありがとう、

ジョン

アセット game.html gamecss3.css 画像 ssk.png

Java コード

webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/game.html");

CSS

body {
  background: #aaa;
}
/* defines styles for each card */
.card {
  width: 72px;
  height: 96px;
  margin: 20px;
  background: url("images/ssK.png");
  /*background: #efefef; */
  position: absolute;
  -webkit-transition: all 1s linear;  
}

HTML シンプルカードゲーム

トランプゲーム

  <section id="game">
    <div id="cards">
      <div id="card1" class="card"></div>
    </div> <!-- #cards -->
  </section> <!-- #game -->
  <footer>
    <p>This is an example of transitioning cards.</p>
  </footer>
</body>
</html>
4

2 に答える 2

0

はい。画像の URL が見つかりません。ウェブホストがある場合は、そこにアップロードして、CSS と HTML のパスをそれぞれ変更します。

于 2013-01-02T15:46:32.433 に答える
0

webview.loadDataWithBaseUrl(...)画像ファイルをダウンロードしてから、 thingy..を使用する必要があります。

于 2014-02-12T22:10:07.933 に答える