Android html高度100%被webview忽略
webview不理解什么是html高度100%,它只是显示一个空白页面。然而,在移动浏览器中,它工作得非常好。有人能帮我吗?我已经考虑了很多建议,但都不管用。正如您在代码中看到的,我特意将html背景颜色设置为红色,以便查看html文档是否确实在我的webview上。我一点也没看到红色,只是纯白色 只有在我努力设定高度的情况下,它才会起作用,我不想这样做。我的代码如下:Android html高度100%被webview忽略,android,css,webview,height,Android,Css,Webview,Height,webview不理解什么是html高度100%,它只是显示一个空白页面。然而,在移动浏览器中,它工作得非常好。有人能帮我吗?我已经考虑了很多建议,但都不管用。正如您在代码中看到的,我特意将html背景颜色设置为红色,以便查看html文档是否确实在我的webview上。我一点也没看到红色,只是纯白色 只有在我努力设定高度的情况下,它才会起作用,我不想这样做。我的代码如下: <!DOCTYPE html> <html> <head> <meta charse
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, height=device-height, user-scalable=no, initial-scale=1, maximum-scale=1">
<title>WhyQ</title>
<link href="http://fonts.googleapis.com/css?family=Titillium+Web:400,400italic,700" rel="stylesheet" type="text/css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<style>
html{
margin:0;
padding:0;
height:100%;
min-height:100%;
background-color:red;
position:relative;
}
body {
font-family: 'Titillium Web', sans-serif;
width: 100%;
min-height: 100%;
height: 100%;
margin: 0 auto;
padding: 0;
background-color:red; /*#E9E9E9;*/
position:relative;
}
</style>
</head>
<body style="position:relative">
<div style="overflow-y:hidden" class="container-fluid login-container">
<div class="row" style="height:15%;">
<div class="col-xs-12 txt-center full-height"></div>
</div>
<div class="row" style="height:13%;">
<div class="col-xs-12 txt-center login-sub-container-whyqLogo full-height"></div>
</div>
<div class="row" style="height:5%;">
<div class="col-xs-12 txt-center"></div>
</div>
<div class="row" style="height:30%;">
<div class="col-xs-12 txt-center login-sub-container-whyqMascot full-height"></div>
</div>
<div class="row" style="height:20%;">
<div class="col-xs-12 txt-center full-height"></div>
</div>
<div class="row" style="height:16%;">
<div class="col-xs-12 txt-center full-height">
<button type="button" class="btn btn-login btn-md" data-toggle="modal" data-target="#loginModal">LOG IN</button>
<a href="./new-order.php" class="btn btn-login btn-md" role="button" style="color:white">TRY IT</a>
</div>
</div>
<!-- Modal -->
<div class="modal" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-loginForm">
<div class="modal-content modal-content-loginForm">
<div class="modal-body modal-body-loginForm">
<div class="container-fluid">
<div class="row-fluid" style="display:none" id="loginName">
<input class="login-input" id="txt_name" name="txt_name" type="text" required placeholder=" NAME"><br/><br/>
</div>
<div class="row-fluid">
<input class="login-input" id="txt_username" name="txt_username" type="text" required placeholder=" EMAIL"><br/><br/>
</div>
<div class="row-fluid">
<input class="login-input" id="txt_password" name="txt_password" type="password" required placeholder=" PASSWORD"><br/><br/>
</div>
<div class="row-fluid" style="display:none" id="loginPwd2">
<input class="login-input" id="txt_password2" name="txt_password2" type="password" required placeholder=" CONFIRM PASSWORD"><br/><br/>
</div>
<div class="row-fluid" style="display:none" id="loginPhone">
<input class="login-input" id="txt_phone" name="txt_phone" type="text" required placeholder=" PHONE NUMBER"><br/><br/>
</div>
<div class="row-fluid">
<a href="#"><img class="icon border-radius-3" src="images/g-icon.png" alt="Google" /></a>
<a href="#"><img class="icon border-radius-3" src="images/f-icon.png" alt="Facebook" /></a>
<button type="button" id="btnRegister" onclick="showRegisterField()" class="btn btn-login-modal btn-sm border-radius-3">SIGN UP</button>
<button type="button" onclick="login()" style="margin-right:10px" class="btn btn-login-modal btn-sm border-radius-3">LOGIN</button>
<!--<button type="button" class="btn btn-login-modal btn-sm border-radius-3"></button>//-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
为什么
html{
保证金:0;
填充:0;
身高:100%;
最小高度:100%;
背景色:红色;
位置:相对位置;
}
身体{
字体系列:“titilliumweb”,无衬线;
宽度:100%;
最小高度:100%;
身高:100%;
保证金:0自动;
填充:0;
背景色:红色;/*#E9E9*/
位置:相对位置;
}
登录
注册
登录
IE和chrome中显示红色,我可以推荐高度:100%代码>使用<代码>高度:100vh代码>因为这会将div设置为视图端口高度的100%。div标记不会自动获取视图端口的高度,您必须告诉它这样做。还删除了以下代码作为位置:相对;是给TGA的,不是那个。还从行标记中删除了高度样式。您可以在css中设置,但每行的高度应该自行设置
html{
保证金:0;
填充:0;
}
身体{
字体系列:“titilliumweb”,无衬线;
宽度:100%;
背景色:红色;/*#E9E9*/
}
.cont高度{
高度:100vh;
}
登录
注册
登录
我在这里遇到了同样的问题:
我回答了自己的问题,问题是使用alignParent而不是match_parent
我希望这就是你的问题所在
在任何情况下,尝试在WebView上添加一些边框,以查看其实际停止的位置。确保WebView布局配置正确: android:layout_height=“匹配父项”
如果您使用了wrap_content,网络视图本身将收缩为零,因此只显示空白页面。您好,谢谢您的回复,但正如我指出的,问题不在浏览器上,而在网络视图上。我对浏览器没有问题。但我会尝试使用vh。