Android 5上的Tianium webview渲染不正确

Android 5上的Tianium webview渲染不正确,webview,titanium,Webview,Titanium,我的安卓手机(三星Galaxy S5,AT&T)刚刚从安卓4.4升级到5.0,现在钛合金的网络视图渲染无法正常工作。我有一个发布的应用程序在Android 4.4上运行良好,但现在在5.0中无法正确渲染(同一部手机,没有应用程序代码更改)。具体地说,窗口的默认画布(至少是屏幕大小的4倍)自动具有巨大的高度和宽度,而将div换行和格式化到绝对位置则不起作用。以前,画布是屏幕的宽度,以便进行文字换行,而窗口的高度是窗口中内容的高度。我用以下合金代码在手机上重现了错误: <Alloy> &

我的安卓手机(三星Galaxy S5,AT&T)刚刚从安卓4.4升级到5.0,现在钛合金的网络视图渲染无法正常工作。我有一个发布的应用程序在Android 4.4上运行良好,但现在在5.0中无法正确渲染(同一部手机,没有应用程序代码更改)。具体地说,窗口的默认画布(至少是屏幕大小的4倍)自动具有巨大的高度和宽度,而将div换行和格式化到绝对位置则不起作用。以前,画布是屏幕的宽度,以便进行文字换行,而窗口的高度是窗口中内容的高度。我用以下合金代码在手机上重现了错误:

<Alloy>
<Window title="Test">
<WebView id="web1" html="<html><head></head><body><p>This is a long paragraph that should have word wrap once it reaches the right side of the screen, but unfortunately the new version of Android seems to be preventing this behavior, which is peculiar, as issues did not arise with prior versions of Android, as far as I can tell.</p></body</html>" class="webclass" backgroundColor="transparent" />
</Window>
</Alloy>


任何帮助都将不胜感激。

我也有同样的问题,我搜索了很多,发现这取决于设备上运行的操作系统

尝试将此代码添加到
js
文件中,它不会解决问题,但应该进行文字包装和放大

var htmlText = "<p>This is a long paragraph that should have word wrap once it reaches the right side of the screen, but unfortunately the new version of Android seems to be preventing this behavior, which is peculiar, as issues did not arise with prior versions of Android, as far as I can tell.</p>"

if(OS_ANDROID) htmlText = '<html><body><div style="width:' + 
        (Titanium.Platform.displayCaps.platformWidth - 20) + 'px; height:auto;">' + 
        htmlText + '</div></body></html>';
$.webView.html = htmlText;
var htmlText=“这是一段很长的段落,一旦到达屏幕右侧,就应该有换行符,但不幸的是,新版本的Android似乎阻止了这种行为,这很奇怪,因为据我所知,以前版本的Android没有出现问题。

” 如果(OS_ANDROID)htmlText=''+ htmlText+“”; $.webView.html=htmlText;
将以下代码添加到每个HTML文件似乎可以在不同版本的Android中创建一致的HTML呈现,并确保屏幕宽度合适:

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">

谢谢你的建议,但出于某种原因,这对我也不起作用。我没有收到任何错误代码。。。由于某些原因,即使使用这种CSS宽度(文本在随机包装之前比屏幕宽约2.5倍),也无法正确包装单词。