Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fullscreen Mode using ActionBarSherlock on Devices running API <11

Is there a way to go in fullscreen mode using ActionBarSherlock on Devices running API <11?

Further Information:

My app is using ActionBarSherlock and while testing on different devices i stumbled on a problem.

If i try tro launch an activity in fullscreen

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 

on a Device running on a API lower than 11 the following error occured:

 05-29 10:12:54.436: E/AndroidRuntime(1034): FATAL EXCEPTION: main
 05-29 10:12:54.436: E/AndroidRuntime(1034): java.lang.RuntimeException: Unable to   start activity      ComponentInfo{de.osthessennews.osthessennewsapp/com.example.listview.PlayVideo}: java.lang.IllegalStateException: You must use Theme.Sherlock, Theme.Sherlock.Light,   Theme.Sherlock.Light.DarkActionBar, or a derivative.

The error occurs, cuz the Line in the Manifest isn't supported for Devices running on API's < 11.

So i know what is causing the problem, but i dont know how to resolve it. I hope one of you guys can help me.

Manifest Snipped:

 <application
    android:allowBackup="true"  
    android:icon="@drawable/ic_launcher"       
    android:label="@string/app_name"
    android:theme="@style/Theme.Sherlock" >
    >   
like image 869
luQ Avatar asked May 29 '13 10:05

luQ


2 Answers

You Can do Programmatically :

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

Use before setContentView().

like image 106
Sam Avatar answered Oct 19 '22 01:10

Sam


The latest version of ABS (ActionBar Sherlock) still does not have a Theme.Sherlock.Light.NoActionBar or Theme.Sherlock.Light.NoActionBar.Fullscreen but you can always create a Fullscreen activity by hiding the ActionBar programmatically as explained on the previous answer.

But if you want to create a theme or style, include

<item name="android:windowFullscreen">true</item>

on it, but that will only hide Android's status bar.

To hide the ActionBar in your activities (extending from SherlockActivity or SherlockFragmentActivity) code:

getSupportActionBar().hide();

That will give you a NoActionBar.Fullscreen effect.

like image 5
Oscar Salguero Avatar answered Oct 19 '22 02:10

Oscar Salguero