【问题标题】:Can't hide titlebar Titanium with Alloy不能用合金隐藏标题栏钛
【发布时间】:2014-09-30 19:54:17
【问题描述】:

我在使用 Alloy MVC 的 Titanium Appcelerator 中遇到了问题。此问题包含以下内容(见图)

我无法删除找到应用名称和徽标的黑条。我正在设备上运行应用程序(Google Nexus,没有模拟器)

我尝试了以下方法来删除它:

XML:

<Alloy>
    <Window>
    </Window>
</Alloy>

TSS:

"Window":
{
    navBarHidden:true,
    fullscreen:true,
    backgroundColor:"Orange",
    orientationModes:[Ti.UI.PORTRAIT],
}

TiApp.XML:

<statusbar-style>default</statusbar-style>
<statusbar-hidden>true</statusbar-hidden>
<fullscreen>true</fullscreen>
<navbar-hidden>true</navbar-hidden>

但是这些选项都不能隐藏这个黑条。在 iOS 模拟器中,它确实通过将属性 fullscreen 设置为 true 来移除导航栏

还有其他方法可以解决这个问题吗?提前致谢!

【问题讨论】:

    标签: android titanium appcelerator titanium-alloy


    【解决方案1】:

    可能是正在显示的 ActionBar 吗?尝试隐藏它。

    修改主题以隐藏操作栏:

    1. 为您的项目添加自定义主题文件:

    平台/android/res/values/custom_theme.xml:

    <?xml version="1.0" encoding="utf-8"?> <resources>
        <style name="Theme.NoActionBar" parent="@style/Theme.Titanium">
            <!-- Depending on the parent theme, this may be called android:windowActionBar instead of windowActionBar -->
            <item name="windowActionBar">false</item>
        </style> </resources>
    

    取自:http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Action_Bar

    【讨论】:

    • 使用@Protossoario 的回答
    【解决方案2】:

    如果您使用的是 Titanium SDK 3.3.0,默认主题之一的 Titanium 主题现在会隐藏操作和状态栏。要使用它,只需将其添加到您的 tiapp.xml。

    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <application android:theme="@style/Theme.Titanium"/>
        </manifest>
    </android>
    

    您可以在此处阅读更多关于 Titanium 为 Android 提供的主题和其他主题:Android Themes

    【讨论】:

      【解决方案3】:

      我刚刚在我的 TiApp.xml 中添加了以下代码来隐藏我的应用名称和 Titanium 徽标所在的操作栏

      <android xmlns:android="http://schemas.android.com/apk/res/android">
          <manifest>
          <application android:theme="@style/Theme.Titanium"/>
      </manifest>
      

      您也可以通过添加状态栏线来隐藏状态栏(时钟、电池电量、通知等所在的位置)

      <fullscreen>false</fullscreen>
      <statusbar-hidden>true</statusbar-hidden>
      <analytics>true</analytics>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多