Android Question WebView - block the top of the page from touches

gigi0ne

Member
Licensed User
Longtime User
Hello everybody,
a perhaps stupid problem.

I have a WebView (fully functional) and I would like to block the top of the page (about 80 pixels) from touches.
I thought that by superimposing a panel, it would have blocked the touches towards the web page, but it is not so.
The top panel switches the touch to the webview.

How can I do to inhibit that part of webView?

Thanks to who will answer
 

drgottjr

Expert
Licensed User
Longtime User
on my device (pixel 3a, android 11, b4a 10.2) i do:
B4X:
   Sub Activity_Create(FirstTime As Boolean)
    'Activity.LoadLayout("Layout")
    Dim webview As WebView
    webview.Initialize("wv")
    Activity.AddView(webview,0%x,0%y,100%x,100%y)
    webview.LoadUrl("https://www.google.com")
    
    Dim panel As Panel
    panel.Initialize("panel")
    Activity.AddView(panel,0%x,0%y,100%x,20%y)
    panel.BringToFront
    Dim color As Int = Colors.ARGB(30, 255, 0, 0 )
    panel.Color = color
End Sub

Sub panel_Touch (Action As Int, X As Float, Y As Float)
    Log("touched the panel")    
End Sub

if you access google.com in a webview, you will see all sorts of touchable object up at the top. my reddish panel sits on top of them. when i touch the panel,
the panel registers the touch, not the webview. none of the buttons responds. if i touch below the panel, ie, on the webview, i can scroll up and down like normal.

since you didn't show what you had already tried, i cannot say why you did not see the same result.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…