Android :: WebView Not Respecting Scaling Percentage
Jun 11, 2010
I have a WebView which I'm trying to have scale to a certain percent on loading the page. The iPhone version of this software uses the HTML meta-tag:<meta name="viewport" content="width=320, initial-scale=0.95, maximum-scale=2.0, user-scalable=1">..Since Android's WebView doesn't seem to respect that tag I hard-coded the percent using setInitialScale(). However, the WebView is just flat-out ignoring this method call. No matter what number I put in there it shows at 100%.
View 5 Replies
Nov 30, 2009
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. 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");
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.
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>
View 2 Replies
View Related
Aug 24, 2012
i am displaying the HTML pages in web view and i gives two button for zoom-in and zoom-out.On clicking of zoom-in i am increasing the scale to make it similar like zoom but after increase scaling the content is going out from the width of screen in both side horizontally and vertically but i want that the content will always be within the boundary of screen,where can i change in android code ,XML or css or tell me how can i see the complete content of page after scaling because the contents are not completely visible.
View 1 Replies
View Related
May 11, 2010
I am scaling the canvas of a linear layout on draw, but this throws off all the hit areas of my views inside of this layout. They respond as if there was no scaling taking place. What do I have to do to get themselves to re-register their hit areas?
View 4 Replies
View Related
Dec 13, 2009
I have some transparent graphics in my game. Up through 2.0.0 they have looked fined. Since Android 2.0.1 though, some parts of the fully transparent regions of the graphics are instead slightly opaque (e.g. a circular gradient that goes to 100% transparency will have a faint halo around it).
I have tried putting my graphics in ../raw/ but that did not help (as described at http://developer.android.com/guide/topics/graphics/2d-graphics.html#d...)
I have also tried exporting the Adobe Illustrator graphics at 16-bit pngs (instead of 8bit), but that did not help either.
View 2 Replies
View Related
Feb 18, 2010
I have a texture with 8 equally sized stripes that I am using as a wall with OpenGL. On my Nexus One it scales it properly However, in emulators and on a G1 (and probably on other hardware), it does not scale properly, as the stripes remain the same width, while the height scales as it should. Is there an option that I need to set that is set to default on my nexus one but not on other platforms?
View 3 Replies
View Related
Jan 5, 2010
I have some 9-patch images on my app, and they work great on the medium density. When I load the app on a High density emulator/device, these images look grainy. It happens only to 9-patch images. The others look great after the pre- scaling. Is there a way to make them look good after the scaling, like the non-9-patch images?
View 10 Replies
View Related
Oct 15, 2010
In a start activity of our android application we're using a linearlayout with an background image for whole space. The image size is 320x480 - the same as device resolution, we're using for testing. The problem is, the image will be scaled und looks not so nice. I tried to use imageview instead, but I've got black borders.
Some ideas, how to avoid scaling or how to get the proper size for background image?!
View 1 Replies
View Related
Jun 22, 2010
Most of the time, Android scaling is nice but I have a case where I don't want any scaling and I can't find how to do this.
I made a simple layout to test code...
View 4 Replies
View Related
Feb 19, 2010
Say I have a TextView of a particular size (doesn't really matter what... fill_parent, 20dip, whatever). Is it possible to tell the text to shrink/grow in size to fit the available space without doing a lot of math?
View 2 Replies
View Related
Sep 17, 2009
I can't wait to try out the new 1.6 goodies, but first I'm retargeting my existing applications, and I decided to start with Daisy Garden. Changing to android:targetSdkVersion="4" caused the application to segfault on startup and discovered that the BitmapFactory.decodeResource method now performs scaling based on screen density. In this case the behaviour is unwanted - I'm loading a set of masks that are scaled later during composition. So I've quickly inserted the following method, which seems to perfectly mimic the previous behaviour:
private Bitmap loadBitmap(int resId) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inTargetDensity = 1; options.inDensity = 1; return BitmapFactory.decodeResource(context.getResources(), resId, options);
}
View 19 Replies
View Related
Jan 14, 2010
Using a VideoView is it possible to set a scale factor for Android? By Default the video view resizes itself to fit the encoded resolution of the Video. Can I force Android to render a video into a smaller or larger rect?
View 3 Replies
View Related
Nov 17, 2010
I need to scale down images coming from a Network stream without losing quality. I am aware of this solution Android: Strange out of memory issue but it is too coarse - inSampleSize is an integer and does not allow finer control over the resulting dimensions. That is, I need to scale images to specific h/w dimensions (and keeping aspect ratio). I dont mind having a DIY bicubic/lancoz algorithm in my code but I cant find any examples that would work on Android as they all rely on Java2D (JavaSE). EDIT: Ive attached a quick source. The original is 720x402 HD screen capture. Please ignore the top 2 thumbnails. The top large image is resized automatically by android (as part of layout) to about 130x72. It is nice and crisp. The bottom image is resized with API and has severe artifacting. Code...
View 1 Replies
View Related
Jun 26, 2010
We're looking for a method to properly scale our textures and world. The current method we're using is having an arbitrary world unit which calculates the screen resolution and receives the size of a pixel on all resolutions. However is there an easier way of implementing a scaling method for game development? We have looked through dip and other android native elements but these don't work as well for a larger scale on game development.
View 3 Replies
View Related
Jan 6, 2010
I developed a game with the g1 in my mind. Now I want to support large screen sizes but I don't want to add in the apk different images for different screen sizes because now the apk is 3mb and when installed thought market it became 6mb (due to protection on). If I have to double the images to support new screens, the apk would be too heavy (about 13mb, I think) so I'm wondering to know if scaling images at runtime by myself (without compatibility mode) maybe the best way for supporting larger screens. Compatibility mode does a great work in scaling images but it slows down drastically the frame rate (I think because the scale operation is made every time an image is used/moved and not only once on the load of the image itself).
View 7 Replies
View Related
Sep 20, 2010
I am using android.hardware.Camera to get a preview and display it on a custom SurfaceView that implements SurfaceHolder.Callback.
I am trying to zoom in to the camera preview surface by a specified scale (not using the camera's digital zoom) but I can't seem to find a correct way to do it. I also need to be able to zoom out and scale down the preview.
I was hoping to be able to do this using a ScaleAnimation but it doesn't seem to work on SurfaceView, nor the FrameLayout containing the SurfaceView.
I also tried setting the size of the SurfaceView using setLayoutParams but that doesn't seem to work too well on various hardware and it would be tough to animate smoothly.
How to achieve this effect? Right now I am starting to think I might have to implement this using GLSurfaceView but I'm very unsure.
View 2 Replies
View Related
Oct 4, 2010
I have a button which I want to occupy 75% of the screen:
On a 480x800 resolution screen this would be 360 pixels wide.
On a 280x320 resolution screen this would be 210 pixels wide.
How do I go about specifying this in my layout XML file?
I understand there is a DIP unit of measurement, but does that also work to scale screen images for resolutions? What DIP measurement would I use for this, and do the images need to be saved at 160dpi.
View 2 Replies
View Related
Aug 4, 2010
How does Android handle scaling of a video being played within a VideoView?
So for example if I have a video that is say 480 X 270 (width and height), aspect ratio 16:9. And, say the VideoView is added to a LinearLayout with LayoutParams of (480, 270). What will be width and height of the rendered video in portrait orientation in a device that is 320 X 480? In landscape? In another device that is 320 X 550?
View 1 Replies
View Related
May 9, 2010
I'm designing an HTML page for display in Android browsers. Consider this simple example page:
<html>
<head><title>Simple!</title>
</head>
<body>
<p><img src="http://sstatic.net/so/img/logo.png"></p>
</body>
</html>
It looks just fine on the standard HVGA phones (320x480), but on HDPI WVGA sizes (480x800 or 480x854) the built-in browser automatically scales the image up; it looks ugly.
I've read that I should be able to use this tag to force the browser to stop scaling my page:
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;" />
... but all that does is disable user scaling (the zoom buttons disappear); it doesn't actually prevent the browser from scaling my image. Adjusting the scale factors (setting them all to 2.0 or 0.5) has no effect at all.
How can I force the WVGA browser to stop scaling my images?
View 3 Replies
View Related
Jun 6, 2012
I have created an HTML5 'app' with a width and height 480 x 800 to be used as an android app.
Plan is that this can be scaled down/up for other Android devices to fit screen.
The app runs fine, but it is not being scaled to my device screen size. I have to scroll up/down and left/right on the every screen.
I have tried nearly every variation of the meta viewport tag with no succes (in the index.html file).
View 1 Replies
View Related
Jul 15, 2009
I want to calculate the performance for some of the task/process.How to find out the percentage of memory used by each process in the android. - is there any in build classprocess to do this?
View 7 Replies
View Related
Jun 8, 2009
Is there a way to display the percentage% of the progress on the bar? Simple write something on the bar in the new SDK? I have searched everywhere for a sample code...
View 3 Replies
View Related
Aug 19, 2009
Is there a way to specify layout_height as a percentage of it's parent?
for example, I want an interview LinearLayout view group to only be 70% of it's parent.
View 2 Replies
View Related
Jun 9, 2010
on average what % battery is your android system using. mine usually uses from 20%-60%. On average its 40%, pretty much after normal use at any given time mine is at 40%. seem normal or a bit high? i have system panel and no app seems to be hogging or anything like that.edit: after some tweaks my android system is anywhere from 10%-40% tops.
View 15 Replies
View Related
Nov 27, 2009
Motorola Droid user coming from iPhone here. One of the features I miss is having the battery percentage indicated in the status bar next to the little icon (in fact, I'd rather just have the percentage rather than the icon). Is there an app to show that in the status bar? It seems the precision of the battery meter is by 10% increments until it reaches 20%, but even that would be better than just the icon.
View 8 Replies
View Related
Mar 8, 2010
To use as an example: lets say that I have 2 EditTexts and one Button that I'm using as a login form. I want the EditTexts to be the same size, one after the other, with the login Button half their widths. Something like this:
The only way that I've been able to find to make the button 1/2 the width (but still maintain it's dynamic sizing) is to use a TableLayout with an empty view as the first field. Something like this:
CODE:.............
That feels like a god-awful hack and there has GOT to be a better way. Do you know of one?
View 1 Replies
View Related
Jun 9, 2010
I want to play a live streaming in mp3, but when i call prepareAsync, "invalid percentage value xxx" shows. This is a example of live streaming:
http://83.231.187.202:80/rtve/radio1.mp3
And this is my simplified code:
CODE:...............
I understand why this is happening, but other apps use this method and don't show any error in logcat. How can i get this?
View 2 Replies
View Related
Oct 15, 2009
I noticed that it is not possible to specify a percentage value for maxWidth.
What is the best way around this?
For example, in the layout xml, is it possible to get a handle on the screen width and apply some kind of arithmetic to it (e.g. maxWidth="(60 * @screenWidth) / 100px")
Also would this approach mean the maxWidth would be automatically recalculated on orientation changes?
View 8 Replies
View Related
Oct 13, 2010
I'm very very new on Android.
I want to put a TextView inside a LinearLayout that fills the 80% of LinearLayout's height.
How can I do that? or How can assign percentage on Widht and Height?
View 1 Replies
View Related
Aug 8, 2010
I know before the upgrade to 2.2 I could view my battery percentage by going to type in the phone number *#*#4636#*#*. Now after the upgrade when I type that in it won't show anymore.Does anyone know if there is a new code to type in?
View 7 Replies
View Related