idan ahal
idan ahal

Reputation: 913

How to hide the navigation bar in Android - corona , lua

I saw some ways to do hide the navigation bar but they don't work for me. I don't understand how to do that and where I need to write the code. I saw this:

View v = findViewById(R.id.view_id)
v.setSystemUiVisibility(View.STATUS_BAR_HIDDEN)

and also this:

view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)

but I don't know where to write this codes and I also need a code for hiding it for all the time. for example: like in the game "Jelly Jump".

Upvotes: 0

Views: 1355

Answers (3)

idan ahal
idan ahal

Reputation: 913

I have founed it. This code worked for me:

if ( system.getInfo("platformName") == "Android" ) then
   local androidVersion = string.sub( system.getInfo( "platformVersion" ), 1, 3)
   if( androidVersion and tonumber(androidVersion) >= 4.4 ) then
     native.setProperty( "androidSystemUiVisibility", "immersiveSticky" )
     --native.setProperty( "androidSystemUiVisibility", "lowProfile" )
   elseif( androidVersion ) then
     native.setProperty( "androidSystemUiVisibility", "lowProfile" )
   end
end

Upvotes: 1

lomza
lomza

Reputation: 9716

In order to hide status and navigation bars:

display.setStatusBar(display.HiddenStatusBar);
native.setProperty("androidSystemUiVisibility", "immersiveSticky");

In case Android's version is < 4.4 (KitKat), at least status bar will be hidden. There are other tags you can use. The full description can be found on my blog post.

Upvotes: 0

Kumar KS
Kumar KS

Reputation: 521

You can hide the navigation bar use,

native.setProperty( key, value )

But it has some restrictions, have a look at this to know more http://docs.coronalabs.com/daily/api/library/native/setProperty.html#androidSystemUiVisibility

Upvotes: 1

Related Questions