html - 如何调用我的 HTML 网页以扩展并适合整个屏幕?
问题描述
我在 Flutter 应用程序中调用了一个 HTML 文件。使用 WebView 获取文件时,我的输出如下图所示,并没有覆盖我的整个屏幕。
这是我的代码:
<html>
<head>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="https://s3.amazonaws.com/cdn.theoremreach/v3/theorem_reach.min.js"></script>
</head>
<body>
<iframe src="https://theoremreach.com/respondent_entry/direct?api_key=abc&user_id=12345"></iframe>
<script type="text/javascript">
var theoremReachConfig = {
apiKey: "abc",
userId: "12345",
onRewardCenterOpened: onRewardCenterOpened,
onReward: onReward,
onRewardCenterClosed: onRewardCenterClosed
};
var TR = new TheoremReach(theoremReachConfig);
function onRewardCenterOpened(){
console.log("onRewardCenterOpened");
}
function onReward(data){
window.postMessage(data.earnedThisSession)
console.log("onReward: " + data.earnedThisSession);
}
function onRewardCenterClosed(){
console.log("onRewardCenterClosed");
}
if (TR.isSurveyAvailable()) {
TR.showRewardCenter();
}
</script>
</body>
</html>
我正在尝试将整个 WebView 放在我的屏幕上。
解决方案
将此添加到您的脑海中应该可以正常工作。
<style>
iframe {
height:100%;
width:100%;
margin:0 auto;
position:absolute;
top:0;
left:0;
}
</style>
推荐阅读
- java - 在 ECLIPSE photon 中导入 gradle 项目时出错
- rust - 如何使用两个指针在 Rust 中迭代链表?
- javascript - 为什么这个元素会传播两个不同的距离?
- node.js - 如何使其仅在使用 async await 生成 pdf 后才发送 pdf
- javascript - Service Worker 在大多数移动浏览器中不起作用
- c++ - fabsf 是 C++11 中 std 命名空间的一部分吗?
- mysql - MySql 中的“DECIMAL DEFAULT 0”是什么意思?
- android - 将价值从活动传递到片段
- oracle - 逐页读取Oracle表中的所有数据
- r - 在 r 中添加对 lightgbm 的回调