Windows Phone Phone 7的Windows Phone屏幕高度不能100%
发布时间:2020-12-14 01:46:03 所属栏目:Windows 来源:网络整理
导读:我正在使用PhoneGap / Cordova开发 Windows Phone应用程序(尽管如此,我相信我遇到的问题使得PhoneGap无关紧要). 无论我做什么,我的html页面的标签都不会垂直填满屏幕. 在Chrome或甚至IE中运行网页时看起来不错 这是模拟器上的样子,我在.css中的标签中添加了
我正在使用PhoneGap / Cordova开发
Windows Phone应用程序(尽管如此,我相信我遇到的问题使得PhoneGap无关紧要).
无论我做什么,我的html页面的标签都不会垂直填满屏幕. 在Chrome或甚至IE中运行网页时看起来不错 这是模拟器上的样子,我在.css中的标签中添加了一个蓝色边框,用于强调发生了什么: 这是身体的css: body{ border: 1px blue solid; } html,body{ height:100%; min-height:100% } 这里是页脚css: div.navbar_table_container { width: 100%; height: auto; position: absolute; bottom: 0; background-image:url(images/bottom-nav.png); background-size:100% 100%; background-repeat:no-repeat; text-align: center; } 并且,因为它可能是重要的,这是xaml文件: <phone:PhoneApplicationPage x:Class="CordovaWP8_2_7_01.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" Background="White" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True" d:DesignHeight="820" d:DesignWidth="480" xmlns:my="clr-namespace:WPCordovaClassLib"> <Grid x:Name="LayoutRoot" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <Grid.RowDefinitions> <RowDefinition Height="*"/> </Grid.RowDefinitions> <my:CordovaView HorizontalAlignment="Stretch" Margin="0,0" x:Name="CordovaView" VerticalAlignment="Stretch" /> <Image Source="SplashScreenImage.jpg" x:Name="SplashImage" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> <Image.Projection> <PlaneProjection x:Name="SplashProjector" CenterOfRotationX="0"/> </Image.Projection> </Image> </Grid> </phone:PhoneApplicationPage> 一个重要的注意事项是,它的工作方式,我想要它在Chrome,IE,当我运行它作为一个Android应用程序. 我能找到的最接近我的问题是 我最近注意到,当我从网络服务器运行相同的代码并使用IE在Windows手机上访问它,它看起来不错.不过,我注意到,只要手机上显示警报信息,IE的地址栏就会消失,并从本地应用程序始终显示出来,从网页内容底部到手机底部的EXACT同样的差距. 所以,这导致我相信,即使它是一个“应用程序”,如果它运行html和javascript,手机留下空间的地址栏,即使它从来没有使用过. 任何帮助或见解将不胜感激.
我尝试在视口元标记中使用device-height,但是我了解到IE不支持该标记.然后经过我的10万google搜索,我发现了
this page.
添加到我的CSS后: @viewport{height:device-height} @viewport{width:device-width} @-ms-viewport{height:device-height} @-ms-viewport{width:device-width} 并将其添加到浏览我所有页面的JavaScript文件中: if (navigator.userAgent.match(/IEMobile/10.0/)) { var msViewportStyle = document.createElement("style"); msViewportStyle.appendChild( document.createTextNode( "@-ms-viewport{width:auto!important}" ) ); msViewportStyle.appendChild( document.createTextNode( "@-ms-viewport{height:device-height!important}" ) ); document.getElementsByTagName("head")[0].appendChild(msViewportStyle); } 然后我的100%的身高开始采取我期望的方式. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 在dplyr中使用’window’函数
- windows – masm32和masm之间的区别?
- 在Windows上的“用户空间”中“捕获”进程自己的sysenter调
- windows – 为什么ReadDirectoryChangesW省略事件?
- windows-firewall – 由Windows防火墙阻止的Teamviewer VPN
- 如何在Windows Azure上重置VM上的管理员密码?
- winapi – Windows中的错误 – DWORD(GetLastError)vs HRES
- CMPT6:如何为Primary Site下各Site system role
- windows-server-2008-r2 – 自动创建主题备用名称(SAN)证书
- 如何在Windows上使用Sys.which查找正确的可执行文件
推荐文章
站长推荐
- windows – AutoHotKey:带多行输入的InputBox
- windows – 为什么在IIS中添加其他应用程序池?
- 如何在Windows批处理脚本或Perl中将文件移动到回
- .net – Windows窗体和ShowDialog问题
- windows-phone-7 – 列表框项目点击动画工具包?
- windows-server-2012-r2 – 使用SAN创建双节点Hy
- 【DIY】FFmpeg Joiner – 多段视频「无损合并」小
- 使用Powershell将EBS卷附加到Windows EC2
- 在windows下安装rPython
- WPF:使子元素’MinWidth/MinHeight约束Window
热点阅读