【问题标题】:Equivalent of .iOS.createNavigationWindow in Android?相当于Android中的.iOS.createNavigationWindow?
【发布时间】:2013-12-09 16:12:39
【问题描述】:

我使用 Titanium 为 iOS 开发了一个应用程序。现在我的想法是尝试将其移植到安卓设备上。

我发现了很多我正在解决的错误,但我似乎没有找到解决这个问题的方法。

我的 iOS 应用程序使用 createNavigationWindow 浏览整个应用程序。 Android 不喜欢该命令,因为它告诉我它是未定义的。

我一直在寻找 createNavigationWindow 的 Android 版本,但找不到。

任何正确方向的提示将不胜感激。

Titanium SDK : 3.1.3

Android: 4.4

谢谢!

【问题讨论】:

    标签: android titanium titanium-mobile navigationwindow


    【解决方案1】:

    在 Android 上没有直接等效的 NavigationWindow。但是你可以做类似的事情来让你的应用程序跨平台运行。另外,我不确定您是否使用 Alloy,但这是一个示例,说明如何构建视图以完成您尝试使用 NavigationWindow 执行的操作。

    index.xml

       <Alloy>
         <!-- iOS -->
         <NavigationWindow id="mainNav" platform="ios" >
            <Require id="default" src="win1"></Require>
         </NavigationWindow>
    
        <!-- Android -->
        <Require id="default" src="win1" platform="android"></Require>
       </Alloy>
    

    win1.xml

    <Alloy>
      <Window id="win1">
        <Label>My App Window</Label>
      </Window>
    </Alloy>
    

    【讨论】:

      【解决方案2】:

      Android 没有导航窗口的概念,但它确实有仅适用于 3.0+ android 版本的操作栏,因此在使用之前您必须牢记这一点。除此之外,您可以通过添加一个来伪造导航窗口查看 android 3.0 的窗口-

          var win=Ti.UI.createWindow();
      
          if(Ti.Platform.osname==='android'){
          var view=Ti.UI.createView({
          backgroundColor:'black',
          height:'40dp',
          top:'0dp',
          width:Ti.UI.FILL
          })
         }
          win.add(view);
          win.open();
      

      谢谢

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-10-16
        • 2013-09-05
        • 2011-04-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-04-26
        相关资源
        最近更新 更多