1.5 SDK problem with WebView.getZoomControls()

by Mariano Kamp » Wed, 29 Apr 2009 03:34:04 GMT


Sponsored Links
 Yeah, I have the same problem.
Anyone?

Is the suddenly breaking and now deprecated getZoomControls() considered
private API?






--~--~---------~--~----~------------~-------~--~----~



1.5 SDK problem with WebView.getZoomControls()

by Jason Parekh » Wed, 29 Apr 2009 04:30:58 GMT


 The preferred API is
WebView.getWebSettings().setBuiltInZoomControls(true).  The new API is
simpler in that just setting the flag will automatically add/hide the
zoom controls.  It will also have better performance on the G1 and
some other devices due to it being hardware composited on top of the
WebView instead of software compositing.

Unfortunately, I'm not sure why you're seeing layout issues with the
old zoom controls.  Could you try changing the LinearLayout's
layout_width to fill_parent?  If this does not work, could you please
post a screenshot?

jason






--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


1.5 SDK problem with WebView.getZoomControls()

by Mariano Kamp » Thu, 30 Apr 2009 00:33:24 GMT


 he following is butt ugly and should not be necessary in a perfect world,
but works for me:

private void createWebView(View parent) {

webView = (WebView) parent.findViewById(R.id.content_web_view);

webView.setWebViewClient(new EmbeddedWebViewClient());


Method setBuiltInZoomControlsMethod = null;

WebSettings webSettings = webView.getSettings();

try {

setBuiltInZoomControlsMethod = webSettings.getClass().getMethod(
"setBuiltInZoomControls",

new Class[] { boolean.class });

} catch (SecurityException e) {

} catch (NoSuchMethodException e) {

}


if (setBuiltInZoomControlsMethod != null) {

try {

setBuiltInZoomControlsMethod.invoke(webSettings, new Object[] { true });

} catch (IllegalArgumentException e) {

} catch (IllegalAccessException e) {

} catch (InvocationTargetException e) {

}

} else {

FrameLayout zoomControlContainer = (FrameLayout) findViewById(R.id.
browse_zoom);

zoomControlContainer.addView(webView.getZoomControls());

webView.getZoomControls().setVisibility(View.GONE);

}

}

I tested it with 1.1 and 1.5.

On Wed, Apr 29, 2009 at 8:47 AM, Mariano Kamp <mariano.k...@gmail.com>wrote:


--~--~---------~--~----~------------~-------~--~----~



1.5 SDK problem with WebView.getZoomControls()

by Jason Parekh » Thu, 30 Apr 2009 01:16:25 GMT


 


I saw your subsequent post about using reflection to try to enable the
new zoom (thanks for posting that so others can re-use), but just in
case you want to fully go back to the old way (which I don't recommend
because of worse performance), try:

<FrameLayout
  android:id="@+id/browse_zoom"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_centerHorizontal="true"
  android:layout_alignParentBottom="true" />

jason

--~--~---------~--~----~------------~-------~--~----~



1.5 SDK problem with WebView.getZoomControls()

by Mariano Kamp » Thu, 30 Apr 2009 02:29:31 GMT


 Jason, thanks, I just tried that and, as you say, it works too.
Regarding performance you talk about the lack of HW acceleration for the old
way or is it layout performance you talk about?






--~--~---------~--~----~------------~-------~--~----~



1.5 SDK problem with WebView.getZoomControls()

by Jason Parekh » Thu, 30 Apr 2009 02:48:54 GMT


 


Not a problem.  I was referring to the lack of HW acceleration for the old way.

jason




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. hyphenated Android directory names and SVN

I am having trouble committing to my svn repository changes made in
files in my Android project in folders that have a hyphen in the name.

In particular /res/layout and /res/layout-land.

It *seems* that the svn client doesn't like the hyphen and truncates
that segment of the url after the hyphen, thus mapping /layout and /
layout-land onto the same url...

Problems include:-
- can't check in two files of same name, one each in /layout and /
layout-land as "they refer to the same URL"
- can't delete/add files from hyphenated folder as they "don't
exist"/"already exist"
- I suspect a commit from the hyphenated folder is overwriting the
file in the non-hyphenated folder in the repository.

I have tried to avoid the problem using the subeclipse plug-in for svn
I normally use, from the svn command line (on Windows 7) and with
Tortoise SVN, without success.

Does anyone know of a workaround?

Is there anyway to avoid hyphens in these folder names?

-- 

2. Why is android build times so slow...

Is it because it's rebuilding it every time?

In eclipse, I went into window -> preferences -> Android -> Build

And turned on Build output -> Verbose on.

And it looks like it's rebuilding my entire app every time I make any
little change.

I assume it should only be doing incremental builds for minor changes?

Any ideas on what I'm doing wrong or how to make it do this behavior?
These build times are killing me! :-)

tia.

-- 

3. How to get current pure UTC time?

4. Which Eclipse?

5. Ensure GPS has fix before proceeding..

6. airplane mode on

7. Some confusion on resource IDs