Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2663] Android: Opacity problem

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-02-21T15:15:42.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsAndroid
Labelscore
Reporterdaniyal
AssigneeSunila
Created2011-04-15T03:26:21.000+0000
Updated2017-03-27T20:12:51.000+0000

Description

Problem#1:

When initializing an object (such as a view) and setting its' opacity to 0 initially (e.g. opacity: 0), then changing it using obj.animate(opacity: 0.6, duration: 1) yields no result. For example:

var viewObj = Ti.UI.createView({
    // other properties
    opacity: 0
});

// inside some handler; onClick if we try changing opacity
viewObj.animate({
    opacity: 0.6,
    duration: 1
});

// yeilds no result

Problem#2:

Changing the opacity with direct assignment or using the "setOpacity" method doesn't update the object with the new opacity, but outputting it on to the console shows the opacity property has been changed however.

For more information kindly refer to this thread; http://developer.appcelerator.com/question/92891/android-setopacity-problem"> http://developer.appcelerator.com/question/92891/android-setopacity...

Comments

  1. daniyal 2011-04-15

    I forgot to mentioned; I'm using Titanium SDK 1.5.0 and Android SDK 2.2

  2. Stephen Tramer 2011-04-15

    Assigning to Don for triage.

  3. Taazza GO 2011-12-13

    Any updates on this issue? Still reproducible.
  4. Onoma Epitheto 2012-02-28

    Hi, plz fix this. On android, you cannot change the opacity of a view neither with changing the property directly or with using setOpacity(newOpacity) method. Thank you in advance. regards,
  5. Stephen Tellis 2012-03-05

    I was able to reproduce this with: TiStudio 1.0.9 GA SDK 1.8.2 GA on Mac OS 10.7
  6. Junaid Younus 2012-08-24

    Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120821095711, issue #2 still valid, issue #1 seems to be fixed.
       var win = Ti.UI.createWindow({backgroundColor: 'white'});
       
       var view = Ti.UI.createView({
           width: 100,
           height: 100,
           backgroundColor: 'red',
           opacity: 0
       });
       
       win.addEventListener('click', function(e)
       {
           Ti.API.info('Should be animating now.');
           
           view.animate({
               opacity: 0.6,
               duration: 1
           }, function(){
               Ti.API.info('Before (should be 0.6): ' + view.opacity);
               Ti.API.info('Setting opacity');
               view.setOpacity(1);
               Ti.API.info('After opacity (should be 1): ' + view.opacity);
           });
       });
       
       win.add(view);
       win.open();
       
  7. Sunila 2014-02-21

    I cannot reproduce the problem, both the setter and the property works. Here is the sample I tried var win = Ti.UI.createWindow({backgroundColor: 'white'}); var view = Ti.UI.createView({ width: 100, height: 100, backgroundColor: 'red', opacity: 0 }); win.addEventListener('click', function(e) { view.animate({ opacity: 0.3, duration: 1 }); }); view.addEventListener('click', function(e) { view.opacity=1; e.cancelBubble=true; }); win.add(view); win.open();
  8. Lee Morris 2017-03-27

    Closing ticket as I am unable to reproduce this issue with the following environment; Pixel (7.1) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source