Frage

I am developed an app for iOS using Titanium. Now my idea is to try to port it to android devices.

I am finding lots of errors which I am solving as I go, but I don't seem to find the solution to this one.

My app for iOS uses createNavigationWindow to navigate through the whole app. Android don't like that command as it tells me it is undefined.

I been looking for an Android version of createNavigationWindow but can't find it.

Any tip in the right direction will be really appreciated.

Titanium SDK : 3.1.3

Android: 4.4

Thanks!

War es hilfreich?

Lösung 2

Android does not have concept of navigational Window but it do have action Bar which only works for 3.0+ android version so you have to keep that in mind before using that.Other than that you can fake the navigation-window by adding a view to window for 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();

Thanks

Andere Tipps

There is not a direct equivalent of NavigationWindow for Android. But you could do something similar to this to have your app run cross platform. Also, I'm not sure if you're using Alloy or not but this is an example of how you could structure your Views to accomplish what you are trying to do with the 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>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top