- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 phonegap 开发应用程序。通过 CLI 构建,而不是 phonegap 构建。我在使用 cordova-plugin-statusbar 插件时遇到问题。它会在打开时增加一个额外的条形高度。这是它的样子。
双高菜单栏:
我用两种方式实现了状态栏。首先通过在config.xml中添加标签
<platform name="ios">
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarStyle" value="default" />
<preference name="StatusBarBackgroundColor" value="#000000" />
</platform>
我还使用 javascript 完成了此操作(首先删除配置标签)并将以下内容添加到我的 DeviceReady 函数中
StatusBar.overlaysWebView( false );
StatusBar.backgroundColorByHexString('#000000');
StatusBar.styleDefault();
为了看看发生了什么,我改变了颜色,我明白了
双状态栏 2 种颜色:
此外,当我删除所有内容或将 overlaysWebView 设置为“true”时,我没有间距,我的内容位于菜单栏下方。
StatusBar.overlaysWebView( true );
这让我相信我没有 CSS 问题。另外,我浏览了我的 css,没有看到任何可以添加它的东西。到目前为止,我的 CSS 非常基础。
/* Style Reset */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
/* End of style reset */
* {
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
}
body {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
/* background-color:#E4E4E4;
background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
background-image:-webkit-gradient(
linear,
left top,
left bottom,
color-stop(0, #A7A7A7),
color-stop(0.51, #E4E4E4)
);
background-attachment:fixed;*/
font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
font-size:12px;
/* height:100%;
margin:0px;
padding:0px;
text-transform:uppercase;
width:100%;*/
background-color: #333333;
}
.md-button {
color:#DFE5E6;
background-color:#1D1D1D;
}
.md-button[disabled] {
border: 1px solid black;
color : rgba(0, 0, 0, 0.26);
background-color: transparent;
}
/* Portrait layout (default) */
.app {
background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
position:absolute; /* position in the center of the screen */
left:50%;
top:50%;
height:50px; /* text area height */
width:225px; /* text area width */
text-align:center;
padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */
margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */
/* offset horizontal: half of text area width */
}
/* Landscape layout (with min-width) */
@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
.app {
background-position:left center;
padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */
margin:-90px 0px 0px -198px; /* offset vertical: half of image height */
/* offset horizontal: half of image width and text area width */
}
}
/* Custom Fonts */
@font-face {
font-family: "sapient_sans_regular";
src: url("../fonts/sapient_sans_regular.TTF") format("opentype");
}
@font-face {
font-family: "sapient_sans_regular_italic";
src: url("../fonts/sapient_sans_regular_italic.TTF") format("opentype");
}
@font-face {
font-family: "sapient_sans_bold";
src: url("../fonts/sapient_sans_bold.TTF") format("opentype");
}
@font-face {
font-family: "sapient_sans_bold_italic";
src: url("../fonts/sapient_sans_bold_italic.TTF") format("opentype");
}
.material-icons {
margin:0px;
color:white;
height:40px;
width:40px;
line-height:40px;
vertical-align: middle;
text-align: center;
background: #1D1D1D;
}
.material-icons.md-menu-item.md-icon {
text-align: left;
}
.material-icons.menuItem {
background: transparent;
color:#DFE5E6;
}
#menuBar ul {
position:fixed;
top:0;
width:100%;
list-style-type: none;
background-color: #1D1D1D;
}
#menuBar li {
text-align:center;
display: inline;
}
.logo {
line-height:11px;
padding:13px 2px;
display: inline-block;
vertical-align: middle;
//float:left;
//margin: auto;
overflow: auto;
width:100%;
background-color: #1D1D1D;
border-bottom: 1px solid white;
}
.my {
//line-height:40px;
text-transform: capitalize;
font-family: "sapient_sans_bold";
//display: inline-block;
font-size:20px;
color: #DFE5E6;
}
.company {
//line-height:40px;
text-transform: capitalize;
font-family: "sapient_sans_bold";
font-size:20px;
color: #6D6E70;
}
#menuListing ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 100%;
background-color: #f1f1f1;
}
#menuListing li a {
font-family:'sapient_sans_regular';
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}
/* Change the link color on hover */
#menuListing li a:hover {
background-color: #555;
color: white;
}
.content {
color: white;
padding:10px;
}
h1 {
font-size:18px;
font-weight:normal;
//margin:0px;
//overflow:visible;
//padding:0px;
//text-align:center;
}
.hidden {
display: none;
}
#map
{
//margin: auto;
//width: 100%;
border: 3px solid green;
padding: 100px;
//height: 90%;
//width: 60%;
}
我已经尝试卸载并重新安装插件和 ios 平台,但问题没有改变。
我已经在多个 IOS 模拟器(不同的手机)上测试过,结果都是一样的,我还没有直接在设备上测试过,但我怀疑它会有所不同。
我注意到 android 也有一个状态栏缓冲区(尽管它不应该),但它只是一个白色的栏。我认为这会建议使用 CSS,但我在运行时没有在浏览器中看到它
phonegap serve
快速更新:我正在从状态栏中休息一下,并努力让我的谷歌地图插件也能正常工作,我做了一些更改,状态栏现在似乎可以正常工作了。一定有某种互动。去看看我是否能弄清楚到底是什么。
一些供引用的HTML索引.html
<!DOCTYPE html>
<html ng-app="snApp">
<head>
<title>My Test App</title>
</head>
<!-- Actual Content -->
<body ng-cloak>
<div ng-include="'app/menuBar/menuBar.html'"></div>
<!-- Main content Area -->
<md-content flex id="main">
<ng-view></ng-view>
</md-content>
</body>
</html>
MenuBar.html(请注意,我已根据此原始帖子进行了一些调整。我已尝试还原它们。)
<div ng-controller="menuBarController as menuBarController" id="menuBarContainer">
<md-toolbar id="menuBar" class="md-short" layout="row">
<div class="menuButton">
<md-icon ng-click="menuBarController.toggleLeftMenu();" md-font-library="material-icons">menu</md-icon>
</div>
<div class="logo">
<span class="my">My</span><!-- this removes the space (for some reason) --><span class="app">App</span>
</div>
</md-toolbar>
<md-sidenav md-component-id="left" class="md-sidenav-left" >
<md-menu-item>
</md-menu-item> <!-- remove this after adding in the buffer -->
<md-menu-item>
<md-button ng-click="menuBarController.toggleLeftMenu();" ng-href="#/">
<md-icon md-font-library="material-icons" class="menuItem">home
</md-icon> Home
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="menuBarController.toggleLeftMenu();" ng-href="#/locations">
<md-icon md-font-library="material-icons" class="menuItem">location_city
</md-icon>Locations
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="menuBarController.toggleLeftMenu();" ng-href="#/map">
<md-icon md-font-library="material-icons" class="menuItem">map
</md-icon>Map
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="menuBarController.toggleLeftMenu();" ng-href="#/navigate">
<md-icon md-font-library="material-icons" class="menuItem">navigation
</md-icon>Navigate
</md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="menuBarController.toggleLeftMenu();" ng-href="#/about">
<md-icon md-font-library="material-icons" class="menuItem">info
</md-icon>About
</md-button>
</md-menu-item>
</md-sidenav>
</div>
菜单栏 Controller
console.log("menuBar.controller.js file loaded");
snApp.controller('menuBarController', ['$mdSidenav', '$window', MenuBarController]);
function MenuBarController($mdSidenav, $window) {
var vm = this;
// vm.operatingSystem = $window.operatingSystem;
vm.operatingSystem = null;
vm.toggleLeftMenu = toggleLeftMenu;
vm.checkForIos = checkForIos;
function toggleLeftMenu() {
$mdSidenav('left').toggle();
}
}
查看示例 - Home.html 页面现在非常简单用于测试:
<!-- home.html -->
<div class="content" ng-controller="HomeController as home">
<h1>Home Page</h1>
<p>{{ home.message }}</p>
</div>
home.controller.js
console.log("home.controller.js file loaded");
angular.module('snApp')
.controller("HomeController", HomeController);
function HomeController() {
//debugger;
var vm = this;
vm.message = "this is a home message";
}
map.html - 这是 map View - 现在有很多内容仅供测试。
<!-- map.html -->
<div class="content" ng-controller="MapController as map">
<h1>Map Page</h1>
<md-content layout-gt-sm="row" layout-padding>
<md-button ng-click="map.setMapToDiv();">show map</md-button>
<md-button ng-click="map.getLocation();" ng-disabled="map.buttonDisabled">{{ map.buttonText }}</md-button>
<md-input-container>
<label>Div Adjustent</label>
<input ng-model="map.divAdjustment">
</md-input-container>
<md-button ng-click="map.adjustDiv();" > Adjust Div Height </md-button>
<p></p>
<p>For testing - buttonEnabled value: <span ng-bind="map.buttonDisabled"></span></p>
<p>{{ map.latitude }}</p>
<p>{{ map.longitude }}</p>
<p>{{ map.message }}</p>
<p></p>
<md-button ng-click="map.showMapDialog();">make map full screen</md-button>
<!-- <div id="map" ng-show="map.locationUpdated"> -->
<div id="map" ng-show="true"></div>
</md-content>
</div>
map .controller.js
console.log("map.controller.js file loaded");
angular.module('snApp')
.controller("MapController", ['$scope', MapController]);
function MapController($scope) {
// Variables
var vm = this;
vm.latitude = 0;
vm.longitude = 0;
vm.locationUpdated = false;
vm.buttonTextDefault = "Get Location";
vm.buttonText = vm.buttonTextDefault;
vm.buttonDisabled = false;
vm.divAdjustment = 0;
vm.message = "Map will display after getting Geolocation";
// Method Declarations
vm.getLocation = getLocation;
vm.setMapToDiv = setMapToDiv;
vm.showMapDialog = showMapDialog;
// vm.adjustDiv = adjustDiv;
// Gets the Current Geolocation for user
function getLocation() {
vm.buttonDisabled = true;
vm.buttonText = "Working...";
var options = { maximumAge: 0, timeout: 10000, enableHighAccuracy: true };
navigator.geolocation.getCurrentPosition(getLocationSuccess,getLocationError,options);
vm.buttonDisabled = false;
}
function getLocationSuccess(position) {
console.log("found geolocation");
vm.latitude = position.coords.latitude;
vm.longitude = position.coords.longitude;
vm.buttonText = vm.buttonTextDefault;
googleMaps.positionMapToCoords(vm.latitude, vm.longitude);
vm.locationUpdated = true;
$scope.$apply();
}
function getLocationError(error) {
console.log("Error finding geolocation");
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
vm.buttonText = vm.buttonTextDefault;
$scope.$apply();
}
function setMapToDiv() {
googleMaps.setMapToDiv();
}
function showMapDialog() {
googleMaps.showMapDialog();
}
}
最佳答案
如果有人碰到这个,遇到同样的问题。我基本上找到了一个更像是解决方法而不是直接答案的解决方案,但可能会有所帮助。我决定仍然使用该插件来正确地为文本着色,但其余的我手动管理。
StatusBar.overlaysWebView(true);
StatusBar.backgroundColorByHexString('#1D1D1D');
StatusBar.styleLightContent();
然后是一些 CSS
#statusBar {
background-color:#1D1D1D;
width:100%;
min-width:100%;
overflow: auto;
min-height:20px;
height:20px;
}
我将这个 div 作为菜单栏的一部分。菜单栏是它自己的 Angular 组件。在 Controller 中,我有一个检查操作系统版本的方法。感谢这篇文章:Detecting iOS / Android Operating system
snApp.controller('menuBarController', ['$mdSidenav', '$window', '$googleMapsService', MenuBarController]);
function MenuBarController($mdSidenav, $window, $googleMapsService) {
var vm = this;
var leftMenuId = 'left';
vm.isIosValue = false;
vm.$onInit = function() {
vm.isIosValue = vm.checkForIos();
}
vm.operatingSystem = null;
vm.toggleLeftMenu = toggleLeftMenu;
vm.getMobileOperatingSystem = getMobileOperatingSystem;
vm.checkForIos = checkForIos;
vm.isIos = isIos;
vm.googleMaps = $googleMapsService;
function toggleLeftMenu() {
mapDivManagement();
$mdSidenav(leftMenuId).onClose(mapDivManagement).toggle();
}
function mapDivManagement() {
if(vm.googleMaps.checkMap() && $window.location.hash == "#/map")
{
if($mdSidenav(leftMenuId).isOpen()) {
console.log("vm.googleMaps.revealMap(true);");
vm.googleMaps.revealMap(true);
}
else {
console.log("vm.googleMaps.revealMap(false);");
vm.googleMaps.revealMap(false);
}
}
}
/**
* Determine the mobile operating system.
* This function sets global variable to one of 'iOS', 'Android', 'Windows Phone', or 'unknown'.
*
* @returns {String}
*
* Source: https://stackoverflow.com/questions/21741841/detecting-ios-android-operating-system
*/
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
//debugger;
// Windows Phone must come first because its UA also contains "Android"
if (/windows phone/i.test(userAgent)) {
// return "Windows Phone";
vm.operatingSystem = "Windows Phone";
}
else if (/android/i.test(userAgent)) {
// return "Android";
vm.operatingSystem = "Android";
}
// iOS detection from: https://stackoverflow.com/a/9039885/177710
else if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
// return "iOS";
vm.operatingSystem = "iOS";
}
else {
vm.operatingSystem = "unknown";
}
// return "unknown";
}
function checkForIos() {
vm.getMobileOperatingSystem();
//vm.operatingSystem = $window.operatingSystem;
if(vm.operatingSystem == 'iOS') {
return true;
}
else {
return false;
}
}
function isIos() {
return vm.isIosValue;
}
}
最后,在我的 menubar.html 文件中,我有这个 div:
<!-- Status Bar -->
<div ng-show="menuBarController.isIos()" id="statusBar"></div>
这将根据操作系统显示或隐藏 div。
不确定这将如何在通话中发挥作用,但除此之外它会让你走得更远。
关于javascript - Phonegap Cordova Statusbar 插件创建双条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39128315/
Example image 如何在 Phonegap 中添加像这张图片这样的 float 气泡通知。 最佳答案 没有您正在寻找的“开箱即用”插件。但是,您可以创建自己的插件或简单地使用 phonega
我正在使用 HTML 和 JS、JQuery Mobile 构建一个应用程序,并使用 PhoneGap Build 进行打包。客户想知道是否可以添加打印功能...有人知道吗?没有 PG Build 打
我已经安装了 Phonegap 使用 $ npm install -g PhoneGap 我也创建了项目。之后我做了 $ PhoneGap build android 它给出了 [phonegap]
我尝试创建 Phonegap 项目,其中需要集成 ASIHTTPRequest 和 JASON 引用, 并出现以下错误 ld: duplicate symbol _SBJSONErrorDomain
我有一个 Phonegap 应用程序,我从早期版本的 Phonegap 开始,我想升级到最新版本。我需要采取哪些步骤来升级它? 我正在寻求一般性答案,但我的具体情况是 Phonegap 1.1.0 -
我已在我的 MAC 电脑(IOS 10.5.8,SDK 3.1.2)上成功安装 PhoneGap。尝试创建一个新的基于 PhoneGap 的应用程序,包含 PhoneGap 框架并将所需的文件复制到
我正在 phonegap 中为三个不同的平台构建一个应用程序:Android、iOS 和 Blackberry。这样做时,我必须检测设备类型,以便我可以在不同平台和不同设备(如 Android Pho
开始在Mac上使用phonegap(Xcode 4,构建iPhone应用程序)我已经阅读了很多有关名为phonegap.plist的文件的内容,包括外部URL的白名单和其他内容。 这是我的问题,我在
所以我有一个运行 Phonegap 1.4.0 的应用程序(不要问),我决定升级到 1.8.1,这样做时 Phonegap 全局变量不再存在,将被替换为实用程序。 所以我转换了每一次出现: var t
我尝试了什么: 我正在开发一个安卓应用程序。在我的应用程序中,我必须打开 -> 向用户显示 Microsoft Office 文档(doc、docx、xls、xlsx、ppt、pptx)内容。为此,我
使用phonegap制作iOS应用时,ChildBrowser插件可以打开一个可以使用phonegap功能的远程页面吗? 例如:在phonegap应用程序中的index.html,调用childbro
我有一个带有 angularjs 的网络应用程序。我想使用 phonegap 将它变成一个移动应用程序 (android)。 我使用了 phonegap 构建:https://build.phoneg
我正在使用 Phonegap build 为每个平台生成可执行文件。每次更改代码时,我都必须在 phonegap build 上上传代码并生成新的 Apk 文件(适用于 android)。我不想在真实
我很生气,这是毫无疑问的,除了明显的可见差异之外,有人报告高度为: $('body').outerHeight(); //1780 与在我的本地 Windows 8 机器上使用 phonegap
我最近使用 phonegap 完成了我的第一个混合应用程序项目。当谈到公开测试时,我有点害怕签名过程。我从这里以及网上的其他地方阅读了许多不同的建议 fragment 来完成这项工作。 以下是如何为
我是 phonegap 的新手,我尝试创建一个简单的 phonegap 应用程序。 使用命令行安装phonegap后:--- 我已经成功创建了项目,但是当我尝试运行 phonegap build io
我正在为 Android 平台制作一个 phonegap 应用程序。在这个应用程序中,我想在多个 html 页面中滑动导航。请告诉我该怎么做。要么在单个 html 页面中完成,要么我必须为此滑动导航创
是否有任何插件可用于 Juce我可以添加哪些库可以同时适用于 IOS 和 android?如果没有,我如何集成 Juce我的电话间隙应用程序中的库? 最佳答案 没有插件。但您可以使用介绍榨汁机来创建不
Phonegap 刚刚推出了一种方法,可以使用以下命令使用本地服务器立即查看您对 phonegap 应用程序的更改: phonegap serve 然后通过下载 PhoneGap Developer
我们对如何集成phonegap插件,然后使用phonegap build构建我们的移动应用程序有一些疑问,这可能吗? 当您使用 Phonegapbuild 构建您的应用程序时,它会为所有受支持的设备构
我是一名优秀的程序员,十分优秀!