如何在Android中隐藏导航栏 - corona,lua

时间:2015-04-07 20:38:49

标签: lua navigation corona

我看到了隐藏导航栏的一些方法,但它们不适合我。我不明白如何做到这一点以及我需要编写代码的地方。我看到了这个:

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

还有这个:

view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION)

但我不知道在哪里编写这些代码,我也需要一个代码来隐藏它。例如:喜欢在游戏" Jelly Jump"。

3 个答案:

答案 0 :(得分:1)

您可以隐藏导航栏使用,

native.setProperty( key, value )

但它有一些限制,看看这个就知道更多http://docs.coronalabs.com/daily/api/library/native/setProperty.html#androidSystemUiVisibility

答案 1 :(得分:1)

我找到了它。这是有效的:

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

答案 2 :(得分:0)

为了隐藏状态和导航栏:

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

如果Android的版本是< 4.4(KitKat),至少会隐藏状态栏。您还可以使用其他标签。完整说明可在我的blog post上找到。

相关问题