Saturday, June 30, 2012

Re: [android-developers] WebView.setEmbeddedTitleBar gone in Jelly Bean? Which alternatives?

> Can't you just create a layout with your title bar view first and the webview below?

This is exactly what I wanted to do in the past when I've started to create GoodNews: Intuitively I've created a ScrollView, added my title view and the WebView below. The problem with this is that the ScrollView and the WebView do not work together well. The user can either scroll vertically *or* horizontally but not both directions at once (diagonal). So if you as a user want to scroll to the bottom right corner of the view, then you need to scroll down at first, lift the finger for a moment and then scroll to the right -- not really what I as a user would expect.

Just search at stackoverflow for "[android] +webview +scrollview" and you will find quite a few of questions related to this topic...

> Or just let your title bar view hover on top of the webview and add a padding to the rendered HTML via JavaScript injection. Or you could inject a HTML-based titlebar with fixed positioning into the webview.

Tried this in the past and it worked fine for HTML which I've provided on my own, but not if I load external WebSites (I am a Google Reader client, so I *need* to load external web pages.

> I haven't seen that title bar in action, so I don't know whether I am missing something obvious here, but just by reading the API documentation for that method it sounds like you can get a simple workaround working for that.

It should behave similar to the address bar of the standard browser: If you scroll down the website, the title bar should disappear and if you scroll back to the top it should reapear. Scrolling horizonally shouldn't affect the title bar at all -- to the user it should look as if it was fixed.

This was exactly the behavior provided by the embedded title bar and if you look at the implementation then you will see that there is no possibility to implement the same just by deriving from WebView as it depends on a few private methods -- especially not in the Jelly Bean version of the WebView as it delegates all it's calls to the new ClassicWebView...

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate