How to make my Activity as Full Screen mode in Android? [duplicate] - android

This question already has answers here:
Fullscreen Activity in Android?
(40 answers)
Closed 5 years ago.
I have an App and SDK, both are different. I included my SDK into my App. Now the problem is I have issues with making my activity in fullscreen. In SDK, classes are NON-Activity class there is no GUI, only backend Process. so I want to make them Full screen view. Here I can not use:
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Because my activity Non-activity class so there is no more window.so plan to use this code,
ws.setJavaScriptEnabled(true);
htmlAd.addJavascriptInterface(new Object()
{
#JavascriptInterface
public void performClick(String strl)
{
Activity activity = (Activity) adViewContext;
if(strl.equals("base")){
View mDecorView = activity.getWindow().getDecorView();
Toast.makeText (activity, "ONE" + strl, Toast.LENGTH_SHORT).show();
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}else{
View mDecorView = activity.getWindow().getDecorView();
Toast.makeText (activity, "TWO" + strl, Toast.LENGTH_SHORT).show();
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
}
}, "ok");
But it does not work, please guide me .

#Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
adjustFullScreen(newConfig);
}
#Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
adjustFullScreen(getResources().getConfiguration());
}
}
private void adjustFullScreen(Configuration config) {
final View decorView = getWindow().getDecorView();
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
} else {
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
}

change your application level theme to
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"/>

Related

Android - How to unhide soft buttons after programatically hiding them?

Some android phones have soft buttons (back, home, menu). I manage to hide them using setSystemUiVisibility as described here.
However, how to make the softbuttons visible pragmatically?
You can use setSystemUiVisibility()
Request that the visibility of the status bar or other screen/window decorations be changed.
SAMPLE CODE
public class MainActivity extends AppCompatActivity {
TextView tvTextView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
setContentView(R.layout.activity_main);
tvTextView=findViewById(R.id.tvTextView);
tvTextView.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
getWindow().getDecorView().setSystemUiVisibility(View.VISIBLE);
}
});
}
Setting View.SYSTEM_UI_FLAG_VISIBLE worked for me.
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);

View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN not working

I want to make a completely transparent status bar and content behind it.
My device runs with 24 API.
I use this code (in my AppCompatActivity):
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
setContentView(R.layout.activity_main);
}
but it doesn't make any effect, my content is still UNDER the status bar;
I also tried to put android:fitsSystemWindows="true" in my root view, but it didn't help either.
I also tried to put the code after setContentView, still no effect.
What am I doing wrong?
replace this with your code :
if (Build.VERSION.SDK_INT < 19)
{
View v = this.getWindow().getDecorView();
v.setSystemUiVisibility(View.GONE);
} else if (Build.VERSION.SDK_INT >= 19) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
Use this function callFullScreen
public void callFullScreen(Activity activity)
{
activity.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
You can remove some lines to get required result, and finally call callFullScreen(); inside onCreate

How to hide navigation bar in Android app?

I was wondering how I could hide the navigation bar in an Android application?
I know how to hide it initially, but as soon as I touch the screen it pops back up. I want to hide it the same way games like Clash of Clans hide it where the only way to make it pop up is by swiping down the notifications or by swiping where the navigation bar should be.
use immersive mode check this Immersive mode
// This snippet hides the system bars.
private void hideSystemUI() {
// Set the IMMERSIVE flag.
// Set the content to appear under the system bars so that the content
// doesn't resize when the system bars hide and show.
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE);
}
// This snippet shows the system bars. It does this by removing all the flags
// except for the ones that make the content appear under the system bars.
private void showSystemUI() {
mDecorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
Here it is in the context of the onCreate method:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
The Android docs have a good explanation of what the different flags do:
Using Immersive Full-Screen Mode
Just put this method in your activity where you want to hide status bar and navigation bar in sticky mode.
#Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
//This is used to hide/show 'Status Bar' & 'System Bar'. Swip bar to get it as visible.
View decorView = getWindow().getDecorView();
if (hasFocus) {
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
the easy way is adding this 2 lines after super.onCreate(savedInstanceState);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
You Can Create An Activity With The Snippet Above,And Then Add Another Windows Above The Layout:
LayoutParams layoutParameteres=new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
v.setLayoutParams(layoutParameteres);
final WindowManager.LayoutParams parameters=new WindowManager.LayoutParams(sizeX, sizeY, WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT);
parameters.gravity=Gravity.CENTER;
parameters.x=0;
parameters.y=0;
wm.addView(v, parameters);
Good Luck With It
In your activity's onCreate method:
this.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Modify this line in the AndroidManifest.xml file
android:theme="#style/Theme.AppCompat.DayNight.NoActionBar"

Sticky immersive mode disabled after soft keyboard shown

I have an app that needs to be full screen most of the time. I know that if an alert is shown or other window is displayed, over the top of the activity window, full screen is temporarily removed. Unfortunately, when a soft keyboard is shown for an EditText or something, when the user has finished with the keyboard, full screen immersive mode is not restored.
Any idea how this can be achieved?
Taken from this sample app by Google, you need to append this to the end of your activity, before the last end bracket:
#Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
// When the window loses focus (e.g. the action overflow is shown),
// cancel any pending hide action. When the window gains focus,
// hide the system UI.
if (hasFocus) {
delayedHide(300);
} else {
mHideHandler.removeMessages(0);
}
}
private void hideSystemUI() {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LOW_PROFILE |
View.SYSTEM_UI_FLAG_IMMERSIVE
);
}
private void showSystemUI() {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
);
}
private final Handler mHideHandler = new Handler() {
#Override
public void handleMessage(Message msg) {
hideSystemUI();
}
};
private void delayedHide(int delayMillis) {
mHideHandler.removeMessages(0);
mHideHandler.sendEmptyMessageDelayed(0, delayMillis);
}
And you should be good. :)
I put this code at onCreate() observer the layout changes
getWindow().getDecorView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
#Override
public void onGlobalLayout() {
Rect rect = new Rect();
getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
int screenHeight = getWindow().getDecorView().getRootView().getHeight();
int keyboardHeight = screenHeight - rect.bottom;
if (keyboardHeight > screenHeight * 0.15) {
setToImmersiveMode();
}
}
});
private void setToImmersiveMode() {
// set to immersive
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
I suggest extending AppCompatActivity into a new class (ImmersiveAppCompatActivity). By doing this, any activity that you create using this class will have built in handling of immersive mode.
If you try and set immersive mode too quickly after the soft keyboard has appeared, it will not hide.
Also note that the handler has been improved by switching to a static handler - this will prevent leaks if the user leaves the activity before the GUI is hidden.
public abstract class ImmersiveAppCompatActivity extends AppCompatActivity {
private HideHandler mHideHandler;
#Override
protected void onCreate(#Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// create a handler to set immersive mode on a delay
mHideHandler = new HideHandler(this);
}
#Override
protected void onResume() {
super.onResume();
setToImmersiveMode();
}
#Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(hasFocus) {
mHideHandler.removeMessages(0);
mHideHandler.sendEmptyMessageDelayed(0, 300);
}
else mHideHandler.removeMessages(0);
}
private void setToImmersiveMode() {
// set to immersive
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
private static class HideHandler extends Handler {
private final WeakReference<ImmersiveAppCompatActivity> mActivity;
HideHandler(ImmersiveAppCompatActivity activity) {
mActivity = new WeakReference<>(activity);
}
#Override
public void handleMessage(Message msg) {
ImmersiveAppCompatActivity activity = mActivity.get();
if(activity != null) activity.setToImmersiveMode();
}
}
}
Here's the Kotlin version:
abstract class ImmersiveAppCompatActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
setToImmersiveMode()
}
override fun onWindowFocusChanged(hasFocus: Boolean) {
super.onWindowFocusChanged(hasFocus)
val runnable = Runnable { setToImmersiveMode() }
val handler = Handler(Looper.getMainLooper())
handler.postDelayed(runnable, 300)
}
private fun setToImmersiveMode() {
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_FULLSCREEN
or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY)
}
}
Now, create your activity using this class:
public class SettingsActivity extends ImmersiveAppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content, new SettingsFragment()).commit();
}
}
I've tested this in Android 5.1 and 7.0 to work in a full screen app that has no action bar.
Additionally, if you using the keyboard in an EditText be aware of the imeOptions. In landscape mode you can get strange full screen editing behavior. This can be disabled by setting imeOptions flags which are contained in the class EditorInfo:
<EditText
android:layout_width="#dimen/pin_width"
android:layout_height="wrap_content"
android:inputType="numberPassword"
android:imeOptions="flagNoExtractUi"
android:ems="10"
android:id="#+id/editTextPIN"
android:textSize="#dimen/pin_large_text_size"/>
https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html
This is the normal behaviour. But you can fix it in two steps :
1. Find out when the keyboard is hidden
2. Set the immersive fullscreen mode (again)
Step 1 is a little bit tricky. You can check out my answer here:
https://stackoverflow.com/a/27567074/2525452
Step 2 is simple:
public static void setImmersiveMode( Activity activity )
{
// Get the Activity's content View
ViewGroup content = (ViewGroup) activity.findViewById( android.R.id.content );
//
// Set the immersive mode flags at the content View
content.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
);
}
To keep immersive mode as it is while soft input enabled and typing. You need to set flags to your activity window. Not to Decor view.
YourActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
To remove it do just,
YourActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
Also keep your system UI visibility settings as you want on decor view.

Using new IMMERSIVE mode in android kitkat

I want to make an activity to go into IMMERSIVE mode and hide top and buttom system bars as soon as it starts.
In developers site of android they say I should use setSystemUiVisibility() and provide SYSTEM_UI_FLAG_IMMERSIVE and SYSTEM_UI_FLAG_HIDE_NAVIGATION.
How can I do this in the OnCreate() method of the activity? I think the setSystemUiVisibility is not provided in the Activity class and it should happen in a view. Is there a workaround?
UPDATE
ok According to doorstuck I added the following lines but I dont see any changes, navigation bar and buttom buttons are still visible :
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
}
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE);
}
//Rest of activity code
Get the decor view:
getWindow().getDecorView().setSystemUiVisibility(...)
Remember that the arguments are bit flags. Only call the method above once:
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE);
Chris Banes gist shows a nice Helper Class we can use to set the immersive mode for all Versions from HoneyComb to Lollipop https://gist.github.com/chrisbanes/73de18faffca571f7292.
Update:
I tried get it from his github repo to include in my project, but i had to clone the gist files into my project and adjsut the packagename. If someone knows how to include it properly as a dependency, u r welcome to help me.
I added it in my FullScreenActivity i want to use the ImmersiveStickyMode like this:
#Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
SystemUiHelper uiHelper = new SystemUiHelper(this, SystemUiHelper.LEVEL_IMMERSIVE ,flags);
uiHelper.hide();
}
You can create global function to go into immersive mode like:
public static void enableImmersiveMode(final View decorView) {
decorView.setSystemUiVisibility(setSystemUiVisibility());
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
#Override
public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
decorView.setSystemUiVisibility(setSystemUiVisibility());
}
}
});
}
public static int setSystemUiVisibility() {
return View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
Above code will also control system UI visibility change. Hope this will help you.
Much nicer and credit to William J. Francis:
public class GameActivity extends Activity{
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
/* my code you dont need this
assets=getAssets();
sGame= new GameView(this, GAME_WIDTH, GAME_HEIGHT);
setContentView(sGame);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
*/
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
#Override
protected void onDoSomethingOtherImportantThing(){
...
}
}
Answer has already been given but here is How to utilize Immersive mode.
In your activity:
just before setContentview().......
call the method: toggleHideyBar();
Follow documentation documentation from Developer android and copy this method in your Activity.
android:immersive="true" will hide the Bottom system bars
<application>
<activity
android:name=".CarrierActivity"
android:label="#string/app_name"
android:excludeFromRecents="true"
android:immersive="true"
android:configChanges="orientation|keyboardHidden|screenSize">
<intent-filter>
<action android:name="com.example.SetupWiz.SUW_CARRIER"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>

Categories

Resources