Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4015] Change Background Color for WebView Loading White Screen

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNot Our Bug
Resolution Date2016-07-08T21:14:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterSanchi Varma
AssigneeShak Hossain
Created2016-07-08T13:52:27.000+0000
Updated2016-07-11T11:00:59.000+0000

Description

When I load a Window with a WebView i.e. var win = Titanium.UI.createWindow({ backgroundColor: Alloy.Globals.colors.Yellow }); var webView = Titanium.UI.createWebView({ url : local_html_file, backgroundColor : Alloy.Globals.colors.Yellow, }); win.add(webView); win.addEventListener('close', function() { win.removeEventListener('close', function() {}); win.remove(webView); webView = null; win = null; }); win.open(); . . . Now in this case A yellow background displays for a fraction of second... then white screen displays for a second until the Window(with webview) loads completely Then the Window loads With the webview . . I want to change the background of in between shown white screen to Yellow instead. (From : When window with webview is loaded and webview in over written to window and white screen is shown To : When WebView is loaded) How can this be done? (Please mention any titanium core library file change if required to perform this action for now)

Comments

  1. Hans Knöchel 2016-07-08

    Hey there, see this native answer on it: http://stackoverflow.com/a/6605214/5537752. You can do the same in Titanium, for example by using webView.setHidden(true); and inside the {{load event, use webView.setHidden(false). It's a very common way to control the background before the content is loaded. You can also wrap it into a view that has a backgroundColor and hide/show it inside there.
  2. Sanchi Varma 2016-07-11

    Thanks Hans. Although setHidden() was not identified as a valid method, but using "opacity : 0" while defining web view, and "webview.opacity = 1" in "load" event listener did the trick. The issue is resolved now
  3. Hans Knöchel 2016-07-11

    Sorry, I meant setVisible(false). Great that it works now!
  4. Sanchi Varma 2016-07-11

    Thanks Hans... setVisible(false) works perfect

JSON Source