Hi
I wish to use tabhost and webview. After strugling now I get those all but webview is on top of tabs and tabs wont work even they are seen. I have made Page1 and Page2 with designer and there all is ok.
Why the orientation is not working with this?
I wish to use tabhost and webview. After strugling now I get those all but webview is on top of tabs and tabs wont work even they are seen. I have made Page1 and Page2 with designer and there all is ok.
Why the orientation is not working with this?
B4X:
Globals
Private template As String
Private WebView1 As WebView
Private ph As Phone
Dim TabHost1 As TabHost ' Devlares the TabHost view
Dim pnlPage1, pnlPage2 As Panel ' Declares the two panels
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Page1") ' Loads "Main" layout file
' 1 = Portrait
' 2 = Landscape
' 9 = Reverse Portrait
' 8 = Reverse Landscape
ph.SetScreenOrientation(2)
pnlPage1.Initialize("Page1")
pnlPage2.Initialize("Page2")
TabHost1.Initialize("TabHost1")
WebView1.Initialize("Page1")
' WebView1.AddToActivity(pnlPage1, 0, 0, 100%x, 80%y) 'this is not working
Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
Activity.AddView(TabHost1, 0, 0, 100%x, 100%y)
TabHost1.AddTab2("Page1", pnlPage1)
TabHost1.AddTab2("Page2", pnlPage2)
Dim template As String
template = File.ReadString(File.DirAssets, "template1.html")
WebView1.ZoomEnabled = False
Dim options As Map
options.Initialize
CreateColumnChartOptions(options)
Dim jg As JSONGenerator
Dim html As String = template
html = html.Replace("$TYPE$", "Bar" & "Chart")
jg.Initialize(options)
html = html.Replace("$OPTIONS$", jg.ToString)
html = html.Replace("$COLUMN1$", "'string', 'Date'")
html = html.Replace("$COLUMN2$", "'number', 'TotalSumPerDay'")
html = html.Replace("$ROWDATA$", Main.json)
ph.SetScreenOrientation(2)
WebView1.LoadHtml(html)
Log(html)
End Sub