Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4371] Android: webview content height and width too large

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Do
Resolution Date2020-01-09T19:52:26.000+0000
Affected Version/sRelease 1.7.0, Release 2.1.0
Fix Version/sSprint 2011-29
ComponentsAndroid
Labelscore
ReporterBen S.
AssigneeUnknown
Created2011-06-04T01:26:34.000+0000
Updated2020-01-10T10:30:59.000+0000

Description

Since 1.7.0, webview content on Android is way too long and wide by default. This leads to a webview where you can scroll way too much to the right and the bottom with no more content being visible inside the webview. On 1.6.3 the height and width of a webview was properly adopted to the text length and the width/height properties. Here's an example code snippet you can run: app.js:
 
Titanium.UI.setBackgroundColor('black');

var win = Titanium.UI.createWindow();
var webview = Titanium.UI.createWebView({
	html:"This is some text inside a webview...it's not very long, but demonstrates what it should",
	height:150,
	width:300,
	autoDetect:[],
	scalesPageToFit:false,
	backgroundColor:"white",
	left:10,
	top:100,
	color:"black"
});
win.add(webview);

win.open();
On 1.6.3 this will look just fine, no scrollbars appear in the webview. Since 1.7.0 you will get a webview where you can scroll vertically and horizontally way beyond the size / length of the visible text.

Attachments

FileDateSize
1.6.3.jpg2011-06-04T01:26:34.000+000065690
1.7.0.jpg2011-06-04T01:26:34.000+0000105139

Comments

  1. Paul Dowsett 2011-06-13

    Ben Note that in the emulator only, webviews are broken on Android 2.3.X. See [Android SDK / Target Android Platform](http://wiki.appcelerator.org/display/guides/Titanium+Compatibility+Matrix#TitaniumCompatibilityMatrix-AndroidSDK%2FTargetAndroidPlatform) for more info. Other than this, great ticket! I wish more of them were like this. ;)
  2. Anirudh Nagesh 2011-07-08

    Associated Helpdesk ticket

    appc.me/c/APP-599983
  3. Don Thorp 2011-07-08

    Opie, triage this please. I'm guessing the difference in display is when we switched to anyDensity:true. I'm wondering if the scroll buttons are causing the page to be larger.
  4. Opie Cyrus 2011-07-21

    Behavior is a side effect of using wide viewport in order to support double tap zoom. Webview size issue can be addressed by setting dimensions in dips. Default zoom behavior can be modified to not load in a zoomed in state by setting "scalesPageToFit:false"
  5. Opie Cyrus 2011-07-21

    created ticket #4744 for new feature request to support specifying the type of viewport that should be used when creating a webview
  6. Ben S. 2011-08-20

    Hi, I'm using anyDensity:false in my android applications. What if I want the webview to set its width and height automatically? I can't see how to prevent this behaviour then...the webview automatically still is way too high and too wide... do I always have to check the screen dimensions and adopt the webview size with SDK 1.7 ?
  7. Davide Cassenti 2012-07-05

    Hello, A customer opened a ticket, reporting the same issue. I did try setting anyDensity to true/false, but nothing seems to help. The WebView is set to be Ti.UI.SIZE large, but I still see the scrollbars. Is there any way to fix this? I'm using SDK 2.1.0 GA
  8. Alan Hutton 2020-01-09

    It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.
  9. Samir Mohammed 2020-01-10

    Closing ticket as it is marked as Won't Do.

JSON Source