Hi,
I am developing a simple browser application for these new "Android on a Stick" devices that plug directly into an HDTV tv set.
I need to display stuff in the browser in "portrait" mode by *physically* mounting/tilting the HDTV set itself 90 degress, so it is taller then it is wide (its mounted on its side).
The problem is that these android sticks do NOT support portrait mode, so I had to resort to using the animation library to "rotate" a panel that I placed the webview control on, so the webview control will now display in a portrait mode.
However, I ran into a problem in which the webview refuses to display the full height of a tall webpage from top to bottom - it seems to cut-off the lower 1/3 of the webpage (see attached Land-Port.png screen shot). (it does works ok when showing a page in landscap mode as seen in port-land.png below, but I need it to also work in portrait mode)
The below test app supports both landscape and portrait mode, but to properly demonstrate this issue, you need to rotate your android device so it's in landscape mode then run the below app. Select "Rotate" from the pop-up menu to toggle modes until you see the text sideways with the top line on the left side of the screen, then you will see it cut's off the bottom of the webpage (as shown in land-port.png).
I have $100 for a *reliable* solution to this issue!
Notes:
1) So I can see what layer is what, I made the activity background yellow and the panel background red
2) I setup a small boarder around the webview so I can see that the panel is fully surrounding the webview and to make sure that wasnt the reason for cutting off the bottom.
3) When in "Rotate" mode (Port=false), I am creating a portrait positioned panel on the landscape activity, then rotated it in an effort to see if that made a difference, but it didn't.
#Region
Activity Attributes
#End Region
Sub Process_Globals
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime AsBoolean)
End Sub
Sub SetDefaults
End Sub
Sub Activity_Resume
End Sub
Sub mnuSettings_Click()
End Sub
Sub mnuRotate_Click
End Sub
Sub mnuRefresh_Click()
End Sub
Sub mnuExit_Click
Sub CreatePreferenceScreen
End Sub
Sub CreatePanel(Port AsBoolean)
End Sub
I am developing a simple browser application for these new "Android on a Stick" devices that plug directly into an HDTV tv set.
I need to display stuff in the browser in "portrait" mode by *physically* mounting/tilting the HDTV set itself 90 degress, so it is taller then it is wide (its mounted on its side).
The problem is that these android sticks do NOT support portrait mode, so I had to resort to using the animation library to "rotate" a panel that I placed the webview control on, so the webview control will now display in a portrait mode.
However, I ran into a problem in which the webview refuses to display the full height of a tall webpage from top to bottom - it seems to cut-off the lower 1/3 of the webpage (see attached Land-Port.png screen shot). (it does works ok when showing a page in landscap mode as seen in port-land.png below, but I need it to also work in portrait mode)
The below test app supports both landscape and portrait mode, but to properly demonstrate this issue, you need to rotate your android device so it's in landscape mode then run the below app. Select "Rotate" from the pop-up menu to toggle modes until you see the text sideways with the top line on the left side of the screen, then you will see it cut's off the bottom of the webpage (as shown in land-port.png).
I have $100 for a *reliable* solution to this issue!
Notes:
1) So I can see what layer is what, I made the activity background yellow and the panel background red
2) I setup a small boarder around the webview so I can see that the panel is fully surrounding the webview and to make sure that wasnt the reason for cutting off the bottom.
3) When in "Rotate" mode (Port=false), I am creating a portrait positioned panel on the landscape activity, then rotated it in an effort to see if that made a difference, but it didn't.
#Region
Activity Attributes
#FullScreen: True
#IncludeTitle: False
#IncludeTitle: False
#End Region
Sub Process_Globals
DimmanagerAsPreferenceManager
DimscreenAsPreferenceScreen
DimscreenAsPreferenceScreen
End Sub
Sub Globals
Dim wv As WebView
Dim iP AsPanel
Dim A1 As AnimationPlus '(you can use the free version 1.x)
Dim iP AsPanel
Dim A1 As AnimationPlus '(you can use the free version 1.x)
End Sub
Sub Activity_Create(FirstTime AsBoolean)
If FirstTime Then
CreatePreferenceScreen
If manager.GetAll.Size = 0 Then SetDefaults
End If
Activity.Color=Colors.Yellow
Activity.AddMenuItem("Settings","mnuSettings")
Activity.AddMenuItem("Refresh","mnuRefresh")
Activity.AddMenuItem("Rotate","mnuRotate")
Activity.AddMenuItem("Exit","mnuExit")
CreatePanel(manager.GetBoolean("Rotate"))
CreatePreferenceScreen
If manager.GetAll.Size = 0 Then SetDefaults
End If
Activity.Color=Colors.Yellow
Activity.AddMenuItem("Settings","mnuSettings")
Activity.AddMenuItem("Refresh","mnuRefresh")
Activity.AddMenuItem("Rotate","mnuRotate")
Activity.AddMenuItem("Exit","mnuExit")
CreatePanel(manager.GetBoolean("Rotate"))
End Sub
Sub SetDefaults
manager.SetString("URL", "http://www.max-soft.com/btest.html")
manager.SetBoolean("Rotate", False)
manager.SetBoolean("Rotate", False)
End Sub
Sub Activity_Resume
wv.LoadUrl(manager.GetString("URL"))
End Sub
Sub mnuSettings_Click()
StartActivity(screen.CreateIntent)
CreatePanel(manager.GetBoolean("Rotate"))
CreatePanel(manager.GetBoolean("Rotate"))
End Sub
Sub mnuRotate_Click
If manager.GetBoolean("Rotate")= FalseThen
manager.SetBoolean("Rotate",True)
Else
manager.SetBoolean("Rotate",False)
End If
CreatePanel(manager.GetBoolean("Rotate"))
manager.SetBoolean("Rotate",True)
Else
manager.SetBoolean("Rotate",False)
End If
CreatePanel(manager.GetBoolean("Rotate"))
End Sub
Sub mnuRefresh_Click()
wv.LoadUrl(manager.GetString("URL"))
End Sub
Sub mnuExit_Click
If Msgbox2("Are you sure you want to Exit?","Exit","Yes","No","",Null) = DialogResponse.POSITIVE Then
Exit Application
End If
End SubExit Application
End If
Sub CreatePreferenceScreen
screen.Initialize( "Settings", "")
Dim cat1 AsPreferenceCategory
cat1.Initialize("Browser")
cat1.AddEditText("URL", "URL", "The URL to display", "http://www.max-soft.com/btest.html")
cat1.AddCheckBox("Rotate", "Rotate", "Rotate Screen 90 Degrees", False)
screen.AddPreferenceCategory(cat1)
Dim cat1 AsPreferenceCategory
cat1.Initialize("Browser")
cat1.AddEditText("URL", "URL", "The URL to display", "http://www.max-soft.com/btest.html")
cat1.AddCheckBox("Rotate", "Rotate", "Rotate Screen 90 Degrees", False)
screen.AddPreferenceCategory(cat1)
End Sub
Sub CreatePanel(Port AsBoolean)
Activity.RemoveAllViews
If Port = TrueThen
iP.Initialize("iP")
Activity.AddView(iP, 0dip, 0dip, Activity.Width , Activity.Height)
iP.Color = Colors.Red
wv.Initialize("wv")
iP.AddView(wv, 5dip, 5dip, iP.Width-10 , iP.Height-10)
Else
iP.Initialize("iP")
Activity.AddView(iP,(Activity.Width /2) - (Activity.Height /2), 0, Activity.Height, Activity.Height)
A1.InitializeRotateCenter("",0,-90,iP)
A1.RepeatCount=0
A1.duration=0
A1.PersistAfter=True
A1.Start(iP)
iP.Color = Colors.Red
iP.SetLayout(0dip, 0dip, Activity.Height, Activity.Width)
wv.Initialize("wv")
iP.AddView(wv, 5dip, 5dip, Activity.Height-10 , Activity.Width-10)
End If
wv.LoadUrl(manager.GetString("URL"))
If Port = TrueThen
iP.Initialize("iP")
Activity.AddView(iP, 0dip, 0dip, Activity.Width , Activity.Height)
iP.Color = Colors.Red
wv.Initialize("wv")
iP.AddView(wv, 5dip, 5dip, iP.Width-10 , iP.Height-10)
Else
iP.Initialize("iP")
Activity.AddView(iP,(Activity.Width /2) - (Activity.Height /2), 0, Activity.Height, Activity.Height)
A1.InitializeRotateCenter("",0,-90,iP)
A1.RepeatCount=0
A1.duration=0
A1.PersistAfter=True
A1.Start(iP)
iP.Color = Colors.Red
iP.SetLayout(0dip, 0dip, Activity.Height, Activity.Width)
wv.Initialize("wv")
iP.AddView(wv, 5dip, 5dip, Activity.Height-10 , Activity.Width-10)
End If
wv.LoadUrl(manager.GetString("URL"))
End Sub
Attachments
Last edited: