Subject: [android-developers] scaling a web-page in a WebView element - msg#05243
List: Android-Developers
Hi,
I'm loading a URL into a WebView and I'm having difficulty setting the
"scale" of the web-page.
Specifically, the web-page is too big (800x600) for the screen, so my
thought is to use "setInitialScale(50)" to reduce the size
xxxxxxxxxx ATTEMPT # 1 xxxxxxxxxxxxxxxxxxxxx
Here is some sample code that doesn't work (i.e. the web-page doesn't
scale to 50%)
WebView wv = (WebView)findViewById(R.id.webview);
wv.loadUrl("
http://www.example.com/android/symptom");
wv.setInitialScale(50);
I also tried switching the order of the function calls but I get the
same result…i.e.,
WebView wv = (WebView)findViewById(R.id.webview);
wv.setInitialScale(50);
wv.loadUrl("
http://www.example.com/android/symptom");
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxx ATTEMPT # 2 xxxxxxxxxxxxxxxxxxxxxxxxx
As an alternative, I have tried to use the "zoomOut()" function like
this:
WebView wv = (WebView)findViewById(R.id.webview);
wv.loadUrl("
http://www.example.com/android/symptom");
wv.zoomOut();
This approach works for a split second, and then the image reverts to
its original size.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Any idea as to what I'm doing wrong?
here is my content view
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="
http://schemas.android.com/apk/res/
android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
--
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
[android-developers] Music player with lyrics supporting
Hi everybody,
My project "Music 100" is just uploaded to code.google.com for public
testing. Because I don’t know how to show picture here, you can go to
http://100town.com/web/public/products/android/music100 for an
illustration of what is about.
The original idea was just for add lyrics support to the Music
project. But I don’t have the permission to change the android code. I
don’t want to re-invent wheel too. So finally it turned out to be a
great alternation of the package Music and some other packages.
The successful things I did includes – discarding some native code and
internal classes but it is still working; an auto-download module is
implemented and a simple HTTP lyrics server protocol is drafted; a
preference system is implemented and lyrics can be shown by line by
line mode and full screen mode.
It is not something quite new but lyrics support is the current
android platform don’t have. If android dev-group is considering
supporting the lyrics in the future development, I can help to do the
coding :)
Anybody has any questions can write to me directly:
android@xxxxxxxxxxx
Enjoy!
--
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Next Message by Date:
click to view message preview
[android-developers] offline access to data
Hey,
I am developing an application with TripIt integration and I make a
call to their API and I get all my data in JSON format and save it in
an object ListTripResponse. This object contains all the data I need
over all the application.
What I do now, I write this object to a txt file (i serialize my
object and save it as a file with ObjectOutputStream) and in every
activity I read this file. But this file is pretty long and it takes a
while to read it. And i have to use and read this object in every
activity! Isn't there a better way to do this? I cannot save this file
in a database because the structure is to complex.
Does anyone has a suggestion?
Wouter
--
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Previous Message by Thread:
click to view message preview
[android-developers] Music player with lyrics supporting
Hi everybody,
My project "Music 100" is just uploaded to code.google.com for public
testing. Because I don’t know how to show picture here, you can go to
http://100town.com/web/public/products/android/music100 for an
illustration of what is about.
The original idea was just for add lyrics support to the Music
project. But I don’t have the permission to change the android code. I
don’t want to re-invent wheel too. So finally it turned out to be a
great alternation of the package Music and some other packages.
The successful things I did includes – discarding some native code and
internal classes but it is still working; an auto-download module is
implemented and a simple HTTP lyrics server protocol is drafted; a
preference system is implemented and lyrics can be shown by line by
line mode and full screen mode.
It is not something quite new but lyrics support is the current
android platform don’t have. If android dev-group is considering
supporting the lyrics in the future development, I can help to do the
coding :)
Anybody has any questions can write to me directly:
android@xxxxxxxxxxx
Enjoy!
--
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Next Message by Thread:
click to view message preview
[android-developers] Re: scaling a web-page in a WebView element
This works for me: (there may be more than you need here)
WebView mywebview = (WebView) findViewById(R.id.wv1);
mywebview.setWebViewClient(new WebViewClient());
mywebview.setWebViewClient(getWebViewClient());
mywebview.getSettings().setSupportZoom(true) ;
mywebview.getSettings().setUseWideViewPort(true) ;
mywebview.setInitialScale(50) ;
mywebview.loadUrl(myUrl);
-John Coryat
--
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@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-developers+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en