PDA

View Full Version : Hiding address bar on Android



edeandrea
6 Dec 2010, 12:04 PM
I'm using the latest released version of Sencha Touch (1.01). I noticed that even though I have fullscreen set to true as shown below


Ext.setup({
fullscreen: true,
icon: '../images/logoBug.png',
glossOnIcon: false,
statusBarStyle: 'black-translucent',
onReady: function() {

... some code
}
});

I am still seeing the address bar at the top of the screen. It is also pushing my bottom toolbar off the bottom of the screen so I can not see it. If I rotate the phone landscape then it renders fine, but as soon as I bring it back portrait the address bar comes back.

I am using an HTC Incredible running Android 2.2.

Any help or ideas?

buz
27 Dec 2010, 12:45 AM
I have the same issue using a Samsung Galaxy - Android 2.2

SpNg
7 Jan 2011, 6:09 PM
I'm having the same issue too. Motorola Droid running Android 2.2 and HTC Incredible running Android 2.2. Has anyone submitted this as a bug report yet?

HTC Hero on Android 2.1 is working fine.

alanrosenthal
1 Mar 2011, 6:48 AM
I am having a similar problem with motorola droid. I get the address bar to hide initially, the onready function seems to accomplish this, but when I am using a list and scroll down and then back up to the top, the address bar reappears. Is there a workaround so I can hide the address bar on demand?

Ralph Haygood
9 Apr 2011, 11:39 PM
Address-bar hiding under Android appears to be generally unreliable on a Nexus One running Android 2.3.3. Sometimes the address bar hides after loading a page, and sometimes it doesn't after loading the very same page. Most annoyingly, merely focusing a textfield or textarea unhides the address bar, and blurring the textfield or textarea doesn't rehide it. I haven't observed such misbehavior in testing on Apple's iPhone simulator or an iPod Touch.

If Google seriously wants people to build web apps instead of native apps, they need to equip the Android browser with a straightforward way to keep the address bar hidden unless there's a good reason for it to be shown. The hackery currently required is ugly and brittle.

I'm using Sencha Touch 1.1.0, by the way.

tkzic
12 Apr 2011, 10:07 PM
If the address bar scrolls your panel off the screen (eg., with page refresh button) the following code will fix it. However it doesn't get rid of the address bar if no scrolling has occurred, or if your panel is less than full screen height. Still working on that one...



if(Ext.is.Android) {
window.scrollTo(0,1);
}

Ralph Haygood
12 Apr 2011, 10:39 PM
If you run this code after your main Panel loads, it will remove the address bar. Panel fullscreen attribute should be set to: true



if(Ext.is.Android) {
window.scrollTo(0,1);
}


Yes, that's exactly what I do, both after initial loading and on focus of any textfield or textarea. I find it curious that this is necessary, however. And even so, the address bar occasionally sneaks back in, under circumstances I haven't been able to characterize yet.

tkzic
13 Apr 2011, 2:18 PM
After much trial and error, I found a workaround that hides the address bar on my Samsung Galaxy-S (2.2.1) Android phone - in every instance including when you load the page by pressing the forward and refresh options on the browser menu.

here's the function to hide the bar (adapted from jquery code found on stackoverflow)



hideAddressBar = function() {

console.log('removing android address bar...');

window.scrollTo(0,0);
var nPageH = document.height;
var nViewH = window.outerHeight;
if (nViewH > nPageH) {
nViewH -= 250;
document.body.style.height = nViewH + 'px';
}

window.scrollTo(0,1);
}


Its called after the mainPanel has loaded, using the following code:




if(Ext.is.Android) {

hideAddressBar();
mainPanel.setHeight(document.body.clientHeight);

}



where mainPanel is an instance of Ext.Panel with attribute fullscreen: true

Another thing to note is that the address bar disappears by itself (without any of the above code) when you re-orient the phone to horizontal.

rgporter
13 Apr 2011, 3:37 PM
I tried the above but the tab bar disappeared, scrolled off the bottom to where it can't be reached.

VinceWebStores
6 Jul 2011, 11:45 PM
Do we have to set the window to new vars when loading the mobile app? Shouldn't it be rendered full screen just like every other page. If I open google.com on my mobile the browser bar also pops away. I tried the window.scrollTo and still it's working half the time ( android 2.2) . Pretty useless. Did somebody post this feature in the bug section of sencha touch or does someone has a good workaround for this?