Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-13628

Android Maps v2: Support the native zOrderOnTop option

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 3.1.0
    • Component/s: Android
    • Environment:

      Description

      Problem

      When the map is placed in a view hierarchy it can sometimes be placed below all views (even below the window background color). This happens for example when you animate the parent view position. But when placed in a quite large view hierarchy I've noted that it randomly can behave the same as described above. This can be prevented if the zOrderOnTop is set to true and the maps view will be placed above all other views in the Activity.

      Run the code on 4.2.x device with Google Play installed.

      app.js

       
      var win = Ti.UI.createWindow({ 
         backgroundColor : 'transparent', 
         orientationModes : [Titanium.UI.PORTRAIT], 
         exitOnClose : true, 
         navBarHidden : true 
      }); 
      win.open(); 
       
      var view2 = Ti.UI.createView({ 
      width : Ti.UI.FILL, 
      height : Ti.UI.FILL, 
      backgroundColor : 'transparent' 
      }); 
       
      var view3 = Ti.UI.createView({ 
      top : 0, 
      left : 0, 
      width : Ti.UI.FILL, 
      height : 200, 
      backgroundColor : 'yellow' 
      }); 
      var label = Ti.UI.createLabel({ 
      color:'black', 
      text: "I'm under the map, and should never be visible! But am I?", 
      textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT, 
      font: { fontSize: 30 }, 
      top: 0, 
      left : 0 
      }); 
      view3.add(label); 
      view2.add(view3); 
       
      var MapModule = require('ti.map'); 
      var mapview = MapModule.createView({ 
          mapType:MapModule.NORMAL_TYPE, 
          //zOrderOnTop: true 
      }); 
      view2.add(mapview); 
       
      win.add(view2); 
       
      setTimeout(function() 
      { 
      var dialog = Ti.UI.createAlertDialog({ 
      message: 'Going to animate, bye bye maps! :/', 
      title: 'Notification', 
      ok: 'Okay', 
      }); 
      dialog.addEventListener('click', function() 
      { 
      view2.animate({ 
      left : 200, 
      duration : 150 
      }); 
      dialog.removeEventListener('click', arguments.callee); 
      }); 
      dialog.show(); 
      }, 5000); 
      

      1. Run the above code, click the alert after 5 seconds
      2. Uncomment zOrderOnTop line, repeat step 1.

      Fail case: yellow label on top of map
      Expected case: should not see yellow label.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                jesper@x-com.se Jesper Jonsson
                Reviewer:
                Ping Wang
              • Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration