【问题标题】:appcelerator titanium - hide navigation bar androidappcelerator 钛 - 隐藏导航栏 android
【发布时间】:2016-11-08 11:53:12
【问题描述】:

是否可以在 Appcelerator Titanium 中永久隐藏 Android 底部导航?关于这个主题的许多问题,但没有很好的解决方案。

<fullscreen> true </fullscreen> 
in tiapp doesn't work with titanium 5.5.1

$.index.addEventListener('open', function(e) {   $.index.activity.actionBar.hide();}); 
doesn't work.

'Window':{navBarHidden:true,tabBarHidden:true,fullscreen:true} in tss 
doesn't work etc.

谢谢。

【问题讨论】:

    标签: titanium appcelerator android-navigation-bar


    【解决方案1】:

    这种方法一直对我有用,将应用设置为全屏,没有导航栏和标签栏。

    假设您的主窗口的 id 未设置或设置为“索引”,只有这应该有效,这是您尝试过的方法:

    $.index.addEventListener('open', function(e) {
    
        $.index.activity.actionBar.hide();
    });
    

    在您的 app.tss 或 index.tss 中:

    "Window":{
        navBarHidden:true,
        tabBarHidden:true,
        fullscreen:true
    }
    

    在您的 tiapp.xml 中:

    <fullscreen>true</fullscreen>
    <navbar-hidden>true</navbar-hidden>
    

    如果问题仍然存在,请尝试将此(指定主题)添加到 tiapp.xml 内清单部分的应用程序或活动标签:

    android:theme="@style/Theme.NoActionBar"
    

    附加信息:

    app.tss: global styles
    index.tss: style for the index view
    

    验证Window的id是否正确,是否有任何样式覆盖了伪装的。

    在窗口打开方法中添加一个console.log,你可以检查是否存在所有的操作栏引用:

    if($.index) {
    
        console.log("window");
    
        if($.index.activity) {
    
            console.log("activity");
    
            if($.index.activity.actionBar) {
    
                console.log("action bar");
    
                if($.index.activity.actionBar.hide) {
    
                    console.log("hide - try to hide");
    
                    $.index.activity.actionBar.hide();
                }
            }
        }
    }
    

    在 Appcelerator 博客上查看这篇文章:Hiding the Android ActionBar

    如果你想隐藏软导航栏,我不知道 Titanium SDK 是那种选项,但是一旦我回答了一个问题,比如你的问题,Fokke Zandbergen 就会这样评论:

    What you want is possible since Titanium 5.2 by using <fullscreen>true</fullscreen> in tiapp.xml.  
    

    Android Documentation: Using Immersive Full-Screen Mode

    Appcelerator Documentation: Hide Soft Navigation Bar

    如果所有这些都不起作用,您可以尝试以下模块:

    Appcelerator Module - Marketplace (free): Immersive view

    在另一个问题中也找到了:How to hide the soft navigation bar on Android with Titanium?

    【讨论】:

    • 谢谢你,里卡多,
    • 谢谢 Ricardo,但我听从了您的所有建议,控制台返回了正确答案:[INFO]:窗口 [INFO]:活动 [INFO]:操作栏 [INFO]:隐藏 - 尝试隐藏[WARN] : ActionBarProxy: (main) [1593,1593] ActionBar 未启用但 android 导航栏仍在显示。我希望我们谈论的是同一件事:我的意思是底部的 android 导航(返回/主页/退出)......
    • 安卓版本:4.4.2
    • 如果你在谈论操作系统按钮,你不能禁用这些。
    • 我已经更新了我的答案,看看它的最后一部分
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-14
    • 2015-10-06
    • 1970-01-01
    • 2017-07-23
    • 1970-01-01
    相关资源
    最近更新 更多