luanavigationcoronasdk

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".


Solution

  • 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