I’m trying to place a facebook pages plugin into a newWebView. My app has content scaling in the config file. With iOS, I can hand the scaled content size to the iframe and things work as expected (correctly sized facebook page inside webView). In Android, it doesn’t seem to matter what I pass in (scaled size or pixel size), I always get a facebook page that is between 1/3 and 1/2 the size of the container (webView). Because of proper behavior on iOS, this seems to be either user error or a tool issue.
========= lua function =====================
local function showFacebookFeed( event )
if system.getInfo(“platformName”) == “Android” then
containerHeight = dim.screenHeight - bannerHeight - adsHeight
containerWidth = dim.screenWidth
containerCenterX = dim.centerX
containerCenterY = bannerHeight + math.floor( containerHeight/2 )
borderX = 75
borderY = 55
diffY = bannerHeight + footerHeight + adsHeight + borderY
diffY = tonumber(diffY) / display.contentScaleY
diffX = borderX / display.contentScaleX
actualHeight = math.floor( display.pixelHeight/2 )
actualWidth = math.floor( display.pixelWidth - diffX )
else
containerHeight = dim.screenHeight - bannerHeight - adsHeight
containerWidth = dim.screenWidth
containerCenterX = dim.centerX
containerCenterY = bannerHeight + math.floor( containerHeight/2 )
borderX = 75
borderY = 55
actualHeight = dim.screenHeight - bannerHeight - footerHeight - borderY - adsHeight
actualWidth = dim.screenWidth-borderX
end
createFbPage(facebookPage,facebookAppId, actualWidth, actualHeight)
webView = native.newWebView(dim.centerX, dim.centerY, containerWidth, containerHeight)
webView:request( tmpHtmlPage, system.DocumentsDirectory )
webView:addEventListener( “urlRequest”, webListener )
end
=========== HTML generated by createFbPage ================
<html>
<head>
</head>
<body>
<iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%FACEBOOKPAGE&tabs=timeline&width=245&height=315&small_header=true&adapt_container_width=false&hide_cover=false&show_facepile=true&appId=FACEBOOKAPPID"
width=“245” height=“315”
style=“border:none;overflow:hidden” scrolling=“no” frameborder=“0” allowTransparency=“true”></iframe>
</body>
</html>