0

这是我尝试使用 Apache Cordova (PhoneGap) 部署的第一个应用程序,但在引用 CSSs 文件时遇到问题。因为我想使用 IntelliJ Idea 工作,所以我遵循了本指南。作为第一步,我正在尝试在 Android 模拟器上部署该应用程序。

我已经能够成功地将应用程序部署到模拟器,唯一的问题是它似乎没有加载 CSS 文件,所以结果是一个黑白无样式的应用程序。我使用以下方法引用 CSS 文件:

<link rel="stylesheet" href="_styles/main.css" />

文件夹层次结构是:
  - assets
    -- www
      --- _styles
        ---- main.css
      --- index.html

主要活动类似于指南中的活动:

public class MyActivity extends DroidGap
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

请注意,同样的事情也会发生在 Eclipse 上。

非常感谢任何帮助。

谢谢

4

1 回答 1

1

You are running into an issue with AAPT. The Android package manager which compiles your app into a .apk file ignores any files or directories that start with '_'. Try renaming your directory to "styles" and updating your references. That should fix the issue with the CSS not being loaded.

于 2012-11-06T14:23:13.110 回答