I finally found out how to smoothly transition to and from Android's full-screen mode. I wanted the status bar to be displayed most of the time, but switched off when the user views an image.
To create the main screen:
setContentView(mGLView);
addContentView(mTopView);
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS;
getWindow().setAttributes(attrs);
mTopView.setPadding(0, 25, 0, 0);
mTopView is a FrameLayout at the top of my window hierarchy. 25 is the height of the status bar.
mGLView is a GLSurfaceView that I use to display the image. Note that at this point, the size of both mTopView and mGLView will fill the entire screen (but be clipped by the status bar at the top edge).
The setPadding() call offsets the child of mTopView so that the child appears just beneath the status bar.
To switch to full screen mode, call this
WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
getWindow().setAttributes(attrs);
change_my_layout();
The above code will essentially hide the status bar and give you an extra 25 pixels at the top of the screen. In change_my_layout(), I do this:
mTopView.setVisibility(View.GONE);
mGLView.setVisibility(View.VISIBLE);
The key here is to use FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_NO_LIMITS. Otherwise the screen will "jerk" a little bit when you apply FLAG_FULLSCREEN.
Also note that mGLView must be positioned behind mTopView in the view stack. Otherwise the mGLView will not be visible to the user EVEN IF the mTopView is set to View.GONE (due to interesting design in Android that's too much to explain here ....).
Failed Attempts:
I tried the "True Android Way" but creating a new full-screen Activity to hold the mGLView. However, this proved to be too slow (at least 500ms on the G1).
Sunday, November 15, 2009
Subscribe to:
Post Comments (Atom)
Its quite useful post, saved me many hours :)
ReplyDeleteWhy can I not access Nubi News on my G2? Says it is not installed on my device. I just used it yesterday. I uninstalled it, but now I do not see the app in Android Market either!
ReplyDeletestill very useful, many thanks
ReplyDeletethis fix is just a work around
ReplyDeleteadd this in your onCreate.
getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
of not full screen activity
Thanks.
DeleteWorks fine thank you
DeleteGiven so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ..Android Training in velachery | Android Training in chennai
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteWe share this information is very impressive to me. I'm very inspired our post to writing this content style & how will be continuous topic describe for some level.
ReplyDeleteSelenium Training in Chennai | Selenium Training | Best Android Training in Chennai with Placement | Android Training in Chennai
nice blog...
ReplyDeletejava training in chennai
java training in omr
aws training in chennai
aws training in omr
python training in chennai
python training in omr
selenium training in chennai
selenium training in omr
I am really happy with your blog because your article is very unique and powerful for new reader.
ReplyDeletehardware and networking training in chennai
hardware and networking training in tambaram
xamarin training in chennai
xamarin training in tambaram
ios training in chennai
ios training in tambaram
iot training in chennai
iot training in tambaram
Nice blog,
ReplyDeleteThanks to share with us,
sap training in chennai
sap training in porur
azure training in chennai
azure training in porur
cyber security course in chennai
cyber security course in porur
ethical hacking course in chennai
ethical hacking course in porur
i never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful
ReplyDeletehardware and networking training in chennai
hardware and networking training in velachery
xamarin training in chennai
xamarin training in velachery
ios training in chennai
ios training in velachery
iot training in chennai
iot training in velachery
I am really happy with your blog because your article is very unique and powerful for new reader.
ReplyDeletedata science training in chennai
data science training in annanagar
android training in chennai
android training in annanagar
devops training in chennai
devops training in annanagar
artificial intelligence training in chennai
artificial intelligence training in annanagar
aşk kitapları
ReplyDeleteyoutube abone satın al
cami avizesi
cami avizeleri
avize cami
no deposit bonus forex 2021
takipçi satın al
takipçi satın al
takipçi satın al
takipcialdim.com/tiktok-takipci-satin-al/
instagram beğeni satın al
instagram beğeni satın al
btcturk
tiktok izlenme satın al
sms onay
youtube izlenme satın al
no deposit bonus forex 2021
tiktok jeton hilesi
tiktok beğeni satın al
binance
takipçi satın al
uc satın al
sms onay
sms onay
tiktok takipçi satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
instagram beğeni satın al
tiktok beğeni satın al
twitter takipçi satın al
trend topic satın al
youtube abone satın al
takipcialdim.com/instagram-begeni-satin-al/
perde modelleri
instagram takipçi satın al
instagram takipçi satın al
takipçi satın al
instagram takipçi satın al
betboo
marsbahis
sultanbet