appcelerator钛-隐藏导航栏android [英] appcelerator titanium - hide navigation bar android

查看:118
本文介绍了appcelerator钛-隐藏导航栏android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在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.

谢谢.

解决方案

此方法始终对我有用,将应用设置为不带导航栏和标签栏的全屏显示.

假设未设置主窗口的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博客上查看此文章:隐藏Android ActionBar

如果您要隐藏软导航栏,我不知道它是Titanium SDK的选项,但是一旦我回答了一个像您一样的问题,Fokke Zandbergen对此进行评论:

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

Android文档:使用沉浸式全屏模式

Appcelerator文档:隐藏软导航栏

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

Appcelerator模块-市场(免费): 沉浸式视图

也在另一个问题中发现:如何使用Titanium隐藏Android上的软导航栏?

Is it possible to hide permanently the Android bottom navigation in Appcelerator Titanium? Many questions about this subject but no fine solutions.

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

Thank you.

解决方案

This method always worked for me, set the app to fullscreen without nav bar and tab bar.

Assuming your main Window's id is not set or is set to 'index', only this should work, it's the approach that you've tried:

$.index.addEventListener('open', function(e) {

    $.index.activity.actionBar.hide();
});

In your app.tss or index.tss:

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

In your tiapp.xml:

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

If the issue it still the same, try to add this (specify theme) to the application or activity tags of the manifest section inside the tiapp.xml:

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

Additional Info:

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

Verify if the id of the Window is correct, if there is any style overwriting the pretended one.

Add a console.log inside the window open method, you could check if exists all the action bar references:

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();
            }
        }
    }
}

Check out this article at the Appcelerator Blog: Hiding the Android ActionBar

If you're trying to hide the Soft Navigation Bar, I don't know it Titanium SDK as that option, but once I've answered a question, like yours, and Fokke Zandbergen comment this:

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

If all of this doesn't work you could try the following module:

Appcelerator Module - Marketplace (free): Immersive view

Also found in the other question: How to hide the soft navigation bar on Android with Titanium?

这篇关于appcelerator钛-隐藏导航栏android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆