小小的土豆
小小的土豆
  • 发布:2015-01-27 11:53
  • 更新:2015-08-12 17:02
  • 阅读:3287

20150126,在HBuilder更新后,webview的setStyle失效!!

分类:Native.js

本周HBuilder更新后,.setStyle设置“下边距” 没有效果!!未更新前是正常的,求解答。

var template = plus.webview.currentWebview();
var subWebview = template.children()[0];

subWebview.setStyle({
bottom: 50 //将底部边距设置为50
});

2015-01-27 11:53 负责人:无 分享
已邀请:
gxy

gxy

var w=plus.webview.getLaunchWebview();
w.setStyle([{'height':'50%'}])
无效,同问

唔知咧

唔知咧

var w= plus.webview.currentWebview();
w.setStyle([{bottom: 50px}])

我加了单位也不行..求大神解答~

levonxu

levonxu

这个问题,我也遇到了,我现在的解决方法是,先self.opener().remove(self),再self.opener().append(self)。这种可以实现,但是效果比较差。

cavvie

cavvie

我也遇到这个问题了,我的环境是:HBuilder
5.6.2.201504192107
Copyright© DCloud Co.,Ltdhttp://www.dcloud.io

note2, android 4.4.2

chender

chender - 与人为善

同样的问题,官方人员回个话啊,貌似是setStyle后界面不会主动去渲染,但是之后如果弹出个输入框什么的触发一下,之前设置的样式就出来了

DCloud_Android_ST

DCloud_Android_ST

embed=plus.webview.currentWebview();  
	embed.setStyle({top:"500px"});

android 测试 没有问题
确认平台,然后贴出你的详细代码来!

  • chender

    你这个代码确实会生效,但是如果当前view有parent,parent顶部至500px的界面不会被渲染出来


    2015-08-12 12:53

  • DCloud_Android_ST

    回复 chender:能贴一下你的测试代码吗 有助于我们排查问题谢谢


    2015-08-12 12:59

chender

chender - 与人为善

index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>hello world</title>
<script type="text/javascript">
document.addEventListener('plusready', function(){
var sub=plus.webview.create("sub.html",null,{top:"50px",bottom:"20px"});
plus.webview.currentWebview().append(sub);
plus.nativeUI.toast("5秒后子页面将变成全屏");
setTimeout(function(){
sub.setStyle({bottom:"0px",top:"0px"});
plus.nativeUI.toast("子页面已变成全屏,但是还是能看到父页面");
},5000);
});
</script>
</head>
<body style="background-color: red;height:500px">
我是父页面
</body>
</html>

sub.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>hello world</title>
<script type="text/javascript">
document.addEventListener('plusready', function(){
});
</script>
</head>
<body style="background-color: blue;height:700px">
我是子页面
</body>
</html>

  • DCloud_Android_ST

    你好 我这边运行了你的代码后,5000毫秒后蓝色页面会实现全屏遮盖 ,未发现"子页面已变成全屏,但是还是能看到父页面"


    2015-08-12 15:51

  • DCloud_Android_ST

    请你查看一下你的手机系统版本多少,什么手机,其次看一下你的hb版本是多少


    2015-08-12 15:53

chender

chender - 与人为善

系统版本是4.2.2,手机型号是华为p6,底部是带虚拟按键的

  • DCloud_Android_ST

    hbuilder版本是多少


    2015-08-12 17:36

  • chender

    回复 DCloud_Android_ST:hbuilder的版本是最新的哈,8月4号更新的,我把底部那个虚拟按键区域隐藏(如果是显示着的),或者显示(如果是隐藏着的),或者横屏一下,就恢复正常了


    2015-08-12 17:52

  • DCloud_Android_ST

    已验证是 部分手机系统有关,我们会尽快修复这个问题


    2015-08-12 18:04

该问题目前已经被锁定, 无法添加新回复