Wednesday, February 23, 2011

Re: [android-developers] 3.0 dialog with WebView inside FrameLayout doesn't resize

For the record,

I just filed a report of this including a simple demonstration app in
apk as well as tgz format:
http://code.google.com/p/android/issues/detail?id=14981

Just run in the 3.0 emulator and something pre-3.0 to see the difference.

Best / Jonas

2011-02-23 22:57, Jonas Petersson skrev:
> Hi all (in particular 3.0 devs),
>
> I just noticed an inconvenience under HoneyComb, and thought I'd share
> it with you for thoughts.
>
> I may have been pushing the limits but in the past I've successfully got
> the following to work as expected on all platforms from 1.5 and up:
>
> // Trimmed code for readability
> final ImageView throbber = new ImageView(context); // Spinning arrows;
> final FrameLayout fl = new FrameLayout(context);
> final WebView i = new WebView(context);
> final Dialog d = new Dialog(context);
> d.requestWindowFeature(Window.FEATURE_NO_TITLE);
> fl.addView(throbber);
> fl.addView(i);
> i.setViewClient(/* bringChildToFrontOnPageFinished */);
> i.loadUrl(someUrlToAFairlyBigPage);
> d.setContentView(fl);
>
> And then I return this dialog from onCreateDialog();
>
> Overall, it technically still works, but the difference is that
> previously when the WebView is broughtToFront, the dialog would size up
> as needed (typically to fill the screen), but now it still stays the
> same height as the throbber. Scrolling is then hard to say the least.
>
> Now, there are some semi-obvious workarounds to make this work
> reasonably (like having a bigger throbber or forcefully use
> setLayoutParams() on throbber/webview), but my question is whether this
> change was an intentional limitation of the redesign (seems somewhat
> unlikely), or an easily fixed bug? Or perhaps I was really just
> exceedingly lucky to get this to work before - but it seemed like a neat
> effect and it works as expected if I use AlertDialog.Builder() instead,
> but I really don't want the title to waste screen space.
>
> Advice very welcome. I can create a minimal example app if you like.
>
> Best / Jonas
>
> PS. While the WebView in the dialog is open, the emulator seems to run
> at full throttle for some obscure reason - however, this happens in
> 1.x/2.x too so that seems unlikely to be related to the issue.
>

--
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

No comments:

Post a Comment