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

Android: Buttons inside views appear on top of all other children

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Found in:SDK 5.1.2.GA, and SDK 5.2.0.v20160202005354
      Using Genymotion "Google Nexus 7 2013 - 5.1.0 - API 22 - 1200x1920", built with CLI version 5.0.6

    • Sprint:
      2018 Sprint 05 SDK, 2018 Sprint 04 SDK

      Description

      Android only: If a button is added to a base view, and then that button should be obstructed by a view added to the base view because it was added after the button, the button will still show through.

      Test Case (be sure to include buttonTest.png at the root of the test project):

      Titanium.UI.setBackgroundColor('#000');
       
      var window = Titanium.UI.createWindow({  
          backgroundColor:'#fff'
      });
       
      // create a main view which will contain the button and the view
      var mainViewContainer = Ti.UI.createView({
      	top: 0,
      	left: 0,
      	right: 0,
      	bottom:0,
      	backgroundColor: 'red'
      });
       
      // create a view which will obscure the button
      var shouldObscureButton = Ti.UI.createView({
      	top: 0,
      	left: 0,
      	width: 200, 
      	bottom: 0,
      	backgroundColor: 'blue'
      });
       
      // create a button which is wider than the obscure view
      var button = Ti.UI.createButton({
      	height: 350,
      	width: 350,
      	left: 0,
      	backgroundImage: 'buttonTest.png',
      	backgroundColor: 'transparent'
      });
       
      // add the button to the main view container before the obscure view
      mainViewContainer.add(button);
       
      // add a view that should obscure the button after the button has been added
      mainViewContainer.add(shouldObscureButton);
       
      // add the main view to the window and open it
      window.add(mainViewContainer);
      window.open();
      
      

      Expected results:
      The button (green checkmark) should be partially obscured by the obstructing view (blue background). This is the behavior on iOS and Mobile Web.

      Actual results:
      The button appears on top of the obstructing view (blue background).

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              mattmendick Matt Mendick
              Reviewer:
              Joshua Quick
            • Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:

                Git Source Code