【发布时间】:2015-04-01 08:21:46
【问题描述】:
我尝试了很多示例,但没有一个是有效的。这就是我想做的。我有一个phonegap eclipse项目。这是项目结构
我想为我的项目添加自定义语言。这是我的 MainActivity.java
import org.apache.cordova.DroidGap;
import android.os.Bundle;
public class MainActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
这是我的 index.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum- scale=1, minimum-scale=1, width=device-width;" />
<title>Directory Reader</title>
<link rel="stylesheet" href="jquery/jquery.mobile-1.1.1.min.css" />
<script src="jquery/jquery-1.8.0.min.js"></script>
<script src="jquery/jquery.mobile-1.1.1.min.js"></script>
<script type="text/javascript" src="cordova-2.0.0.js"></script>
<style type="text/css">
@font-face {
font-family: MyCustomFont;
src: url("NotoSansSinhala-Regular.eot") /* EOT file for IE */
}
@font-face {
font-family: MyCustomFont;
src: url("NotoSansSinhala-Regular.ttf") /* TTF file for CSS3 browsers */
}
body {
font-family: MyCustomFont, Verdana, Arial, sans-serif;
font-size: medium;
color: black
}
</style>
</head>
<body>
<p> test goda </p>
</div>
</body>
</html>
我想显示的字体仍然没有显示在移动设备上。它显示英文字符“test goda”。知道如何解决这个问题吗?
【问题讨论】:
-
解决这个问题的任何想法。
-
你真的在浏览器上运行 index.html 吗?
-
no.. 但是当应用程序安装在设备上时,我如何知道 index.html 的位置。我尝试在浏览器上提供 index.html 位置。但浏览器也是显示英文字符。不是我要显示的字体。
-
是的,首先你需要在浏览器上试一试,可能是ut字体文件的引用有一些问题....请重新检查你的代码并先在浏览器上测试。
-
字体在根目录。我找不到错误在哪里。无论如何感谢您的帮助
标签: android css cordova phonegap-build