I don’t know if my question is dumb but I want to create a WebView file that works with different screen types.
myClasse = native.newWebView( display.contentCenterX, display.contentCenterY+25, 1422, 720 )
myClasse:setNativeProperty("setAllowFileAccess", true)
myClasse:request( "ns4.html", system.ResourceDirectory )
end
what I don’t understand is that this code works with an amazon fire 7 tablet but when I tried it on another device the image is offset.
here is my config.lua file
application =
{
content =
{
width = 768,
height = 1024,
scale = "letterbox",
fps = 60,
--[[
imageSuffix =
{
["@2x"] = 2,
["@4x"] = 4,
},
--]]
},
}
XeduR
March 21, 2023, 8:37am
2
I don’t remember if I or someone else has pointed this to you yet, but have you read the content scaling guide?
Content scaling can be a mystery even for some seasoned developers. Let’s try to demystify it.
First, forget pixels. You are going to create a virtual content area that is measured in values that make sense for you to use. Your content area could be 1 x 1 if you want. Of course to position something on the screen you would need to use fractional values, which is probably pretty inconvenient. You could match your content area to some device standards like a width of 1080 and a height of 1920. Th…
Depending on your content area, you can use a much smaller size for your web view window. Similarly, if you want to make it as large as possible, while always fitting it inside the screen, then you can use display.actualContentWidth and its counterpart to get the device specific screen parameters.
system
Closed
September 17, 2023, 8:37am
3
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.