Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18931] Android: Label shadow color & shadow offset property not working on android lollipop

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionNot Our Bug
Resolution Date2015-06-10T08:52:03.000+0000
Affected Version/sRelease 4.0.0
Fix Version/sRelease 4.1.0
ComponentsAndroid
Labelslabel, qe-4.0.0, shadow
ReporterLokesh Choudhary
AssigneeAshraf Abu
Created2015-05-20T18:56:11.000+0000
Updated2015-07-14T23:45:14.000+0000

Description

Steps To Reproduce:

1. Create an android app with the following code in the app.js:
var win = Ti.UI.createWindow({
	backgroundColor:'grey'
});

var label = Ti.UI.createLabel({
    color: '#900',
    font: {
        fontSize: 48
    },
    text: 'A simple label',
    textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
    top: 30,
    width: 500,
    height: 200
});

var change = Ti.UI.createButton({
    bottom: 10,
    title: "change the shadow of the label"
});

change.addEventListener("click", function() {
    label.shadowColor = "blue";
    label.shadowOffset = {
        x: 10,
        y: 10
    };
});

win.add(label);
win.add(change);
win.open();
2. Build the app for android lollypop device. 3. Click on the button "Change the shadow of the label".

Actual Results:

1. The label shadow does not change. This happens only on android lollypop.

Expected Results:

1. The label shadow should change to what's specified.

Comments

  1. Ashraf Abu 2015-06-10

    [~lchoudhary] I believe it's not our bug and rather how Android Lollipop's native setShadowLayer() behavior has changed. When everything else is set but shadowRadius is left empty or 0, no shadow will be shown at all on Lollipop. You need to specify it as at least a non zero value, eg 1. This seems to be a native behavior. See code below for example:
       var win = Ti.UI.createWindow({
       	backgroundColor:'grey'
       });
        
       var label = Ti.UI.createLabel({
           color: '#900',
           font: {
               fontSize: 48
           },
           text: 'A simple label',
           textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
           /*
           shadowRadius: 1,
           shadowColor: "blue",
           shadowOffset : {
               x: 10,
               y: 10},
               */
           top: 30,
           width: 500,
           height: 200
       });
        
       var change = Ti.UI.createButton({
           bottom: 10,
           title: "change the shadow of the label"
       });
        
       change.addEventListener("click", function() {
       	label.shadowRadius = 1;
           label.shadowColor = "blue";
           label.shadowOffset = {
               x: 10,
               y: 10
           };
       });
        
       win.add(label);
       win.add(change);
       win.open(); 
       
  2. Lokesh Choudhary 2015-07-14

    Closing.

JSON Source