我正在使用PhoneGap/Cordova开发一个Windows Phone应用程序(虽然我认为我遇到的问题与它是PhoneGap无关)。
无论我做什么,我的html页面的标签都无法垂直填充屏幕。
在Chrome甚至IE中运行页面时看起来很好。
这是在模拟器上的样子,在.css中添加了一个蓝色边框以强调发生了什么:
下面是body的css:
这是页面底部的CSS样式表:
一个重要的注意点是,它在Chrome、IE以及作为Android应用程序运行时都按照我想要的方式工作。
与我的问题最接近的问题是 Phonegap Windows Phone gap space bottom,但那里的答案对我没有帮助。
我最近注意到,当我从Web服务器上运行相同的代码并在Windows手机上使用IE访问时,它看起来很好。然而,我确实注意到每当Alert在手机上显示时,IE的地址栏就会消失,并留下与本机应用程序始终显示的底部网页内容到手机底部的完全相同的间隙。
因此,这让我相信,即使它是一个“应用程序”,如果它运行HTML和JavaScript,手机也会留出地址栏的空间,即使它从未被使用。
任何帮助或见解将不胜感激。
下面是body的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,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应用程序运行时都按照我想要的方式工作。
与我的问题最接近的问题是 Phonegap Windows Phone gap space bottom,但那里的答案对我没有帮助。
我最近注意到,当我从Web服务器上运行相同的代码并在Windows手机上使用IE访问时,它看起来很好。然而,我确实注意到每当Alert在手机上显示时,IE的地址栏就会消失,并留下与本机应用程序始终显示的底部网页内容到手机底部的完全相同的间隙。
因此,这让我相信,即使它是一个“应用程序”,如果它运行HTML和JavaScript,手机也会留出地址栏的空间,即使它从未被使用。
任何帮助或见解将不胜感激。