B Baris Karadeniz Active Member Licensed User May 7, 2016 #1 I have an iOS webview app. I used "scaled to fit" in iOS and it works good. But in android, there is no such property. I used horizontal and vertical anchors as BOTH. But it didn't work. I wrote; WebView1.width = 100%x WebView1.height= 100%y to the script in visual designer, it didn't work too. What should I do?
I have an iOS webview app. I used "scaled to fit" in iOS and it works good. But in android, there is no such property. I used horizontal and vertical anchors as BOTH. But it didn't work. I wrote; WebView1.width = 100%x WebView1.height= 100%y to the script in visual designer, it didn't work too. What should I do?
Erel B4X founder Staff member Licensed User Longtime User May 7, 2016 #2 Size to fit affects the content size. Anchors and designer script affect the WebView size. If the anchors didn't work for you then you did something wrong. Can you upload the layout file? Upvote 0
Size to fit affects the content size. Anchors and designer script affect the WebView size. If the anchors didn't work for you then you did something wrong. Can you upload the layout file?
B Baris Karadeniz Active Member Licensed User May 7, 2016 #3 Layout files are given attached. Attachments layout1.bal layout1.bal 1.2 KB · Views: 647 layout2.bal layout2.bal 1.2 KB · Views: 628 Upvote 0
Erel B4X founder Staff member Licensed User Longtime User May 7, 2016 #4 If you want the WebView to completely fill the screen then you need to make sure that all the distances are 0: My guess is that the problem is not with the WebView but with its content. Try this (add a reference to JavaObject library): Code: Dim jo As JavaObject = WebView1 jo.RunMethod("setInitialScale", Array(1)) Upvote 0
If you want the WebView to completely fill the screen then you need to make sure that all the distances are 0: My guess is that the problem is not with the WebView but with its content. Try this (add a reference to JavaObject library): Code: Dim jo As JavaObject = WebView1 jo.RunMethod("setInitialScale", Array(1))
B Baris Karadeniz Active Member Licensed User May 7, 2016 #5 I selected Java Object library and wrote the above statements in to the Sub Globals. But "setInitialScale" is red and there is a message in log. Upvote 0
I selected Java Object library and wrote the above statements in to the Sub Globals. But "setInitialScale" is red and there is a message in log.
B Baris Karadeniz Active Member Licensed User May 8, 2016 #6 Sorry. It is not red but the statement below is written in the log; This sub should only be used for variables declaration or assignments of primitive values. (warning #29) What should I do? Upvote 0
Sorry. It is not red but the statement below is written in the log; This sub should only be used for variables declaration or assignments of primitive values. (warning #29) What should I do?
klaus Expert Licensed User Longtime User May 8, 2016 #7 You should move the code from Globals to Activity_Create. The Global routine should be used only for variable declaration or assignments of primitive values as the warning says. Upvote 0
You should move the code from Globals to Activity_Create. The Global routine should be used only for variable declaration or assignments of primitive values as the warning says.
B Baris Karadeniz Active Member Licensed User May 8, 2016 #8 Unfortunately webview doesn't fit on the screen with the above codes too. There is another method given below with webviewsettings. It works. But when I zoom in, view goes to right but doesn't go to the left. Code: Dim WebViewSettings1 As WebViewSettings WebViewSettings1.setDefaultZoom(WebView1, "FAR") WebViewSettings1.setLoadWithOverviewMode(WebView1, True) WebViewSettings1.setUseWideViewPort(WebView1, True) WebViewSettings1.setAllowFileAccess(WebView1, True) Is there any other better solution? Upvote 0
Unfortunately webview doesn't fit on the screen with the above codes too. There is another method given below with webviewsettings. It works. But when I zoom in, view goes to right but doesn't go to the left. Code: Dim WebViewSettings1 As WebViewSettings WebViewSettings1.setDefaultZoom(WebView1, "FAR") WebViewSettings1.setLoadWithOverviewMode(WebView1, True) WebViewSettings1.setUseWideViewPort(WebView1, True) WebViewSettings1.setAllowFileAccess(WebView1, True) Is there any other better solution?