【问题标题】:Some of Bootstrap3 glyphicons are not displayed correctly on phonegap android webview某些 Bootstrap3 字形图标在 phonegap android webview 上未正确显示
【发布时间】:2013-10-25 08:55:12
【问题描述】:

请查看this attached screenshot。 这是我的 PhoneGap 测试应用 - 在 Galaxy S4 上拍摄。

您应该会看到铃铛、书签、公文包和相机图标(以及更多)未按预期显示。

以下是我的观察:

  1. 所有图标都可以在 PC 和移动设备上的浏览器(chrome、safari)中正确显示
  2. 所有图标都可以在同一个iOS应用中正确显示(在iphone/ipad、ios7中签入)

“问号”只能在 Android 应用中看到。

有人知道原因吗?

【问题讨论】:

  • 我在我的 GS3 上看到了同样的问题。除了选择不同的图标之外,还没有找到解决它的方法。
  • 我在 Firefox 和 chrome 中显示问号时遇到了同样的问题。
  • 我在这里遇到了与 Desktop Chrome 34 类似(但不相同)的问题。我使用的是包含 Bootstrap 3.0.0 的脚手架 MVC5 应用程序,升级 Bootstrap NuGet 包 到 3.1.1 解决了我的问题。

标签: android twitter-bootstrap cordova twitter-bootstrap-3 glyphicons


【解决方案1】:

这可能是因为 bootstrap min .css 文件和字形文件的版本不匹配。

【讨论】:

    【解决方案2】:

    这是转义序列的问题。如果您可以可靠地维护 UTF-8 编码的 CSS 文件,则可以覆盖 Bootstrap 默认值以使用实际的非转义字形。

    (根据您的浏览器,以下代码可能会包含一堆框。但是,复制代码并将其粘贴到 UTF-8 文档中应该会保留这些值。)

    @charset "UTF-8";
    
    .glyphicon-bell:before {
      content: "?";
    }
    .glyphicon-bookmark:before {
      content: "?";
    }
    .glyphicon-briefcase:before {
      content: "?";
    }
    .glyphicon-calendar:before {
      content: "?";
    }
    .glyphicon-camera:before {
      content: "?";
    }
    .glyphicon-fire:before {
      content: "?";
    }
    .glyphicon-lock:before {
      content: "?";
    }
    .glyphicon-paperclip:before {
      content: "?";
    }
    .glyphicon-pushpin:before {
      content: "?";
    }
    .glyphicon-wrench:before {
      content: "?";
    }
    

    您也可以更改转义序列来解决此问题,但浏览器支持会有所不同。如果您只针对 Android/BlackBerry,以下应该可以正常工作:

    .glyphicon-bell:before {
      content: "\d83d\dd14";
    }
    .glyphicon-bookmark:before {
      content: "\d83d\dd16";
    }
    .glyphicon-briefcase:before {
      content: "\d83d\dcbc";
    }
    .glyphicon-calendar:before {
      content: "\d83d\dcc5";
    }
    .glyphicon-camera:before {
      content: "\d83d\dcf7";
    }
    .glyphicon-fire:before {
      content: "\d83d\dd25";
    }
    .glyphicon-lock:before {
      content: "\d83d\dd12";
    }
    .glyphicon-paperclip:before {
      content: "\d83d\dcce";
    }
    .glyphicon-pushpin:before {
      content: "\d83d\dccc";
    }
    .glyphicon-wrench:before {
      content: "\d83d\dd27";
    }
    

    【讨论】:

    • 你的第一部分工作完美!谢谢。通过使用第二部分,“相机”图标仍然在 chrome 中显示为“问号”。
    • 我修复了 .glyphicon-camera 的 CSS 错误。感谢您的反馈!
    • 尝试了第一部分,不敢相信字形居然出现在终端 vim 中。让我开心:)
    • thanx...措辞很好。
    • 我在 Chrome 32.0.1700.76 m 上遇到了这个问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-29
    • 2020-11-16
    • 1970-01-01
    • 2016-11-06
    • 2017-01-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多