how to create shadow/sticker effect for text in Appcelarator

时间:2016-04-04 18:02:40

标签: ios titanium appcelerator appcelerator-mobile appcelerator-titanium

I am trying to get this effect for text in titanium/appcelerator (latest).enter image description here

so - after research I came up with this..

 var win = Ti.UI.createWindow({
     backgroundColor: '#333',
     exitOnClose: true,
     fullscreen: false,
     layout: 'vertical',
     title: 'Label Demo'
 });

 var label1 = Ti.UI.createLabel({
     color: '#000',
     font: {
         fontSize: 32,
         fontFamily: 'Papyrus',
         fontWeight: 'bold'
     },

     shadowColor: '#aaa',
     shadowOffset: {
         x: 2,
         y: 2
     },

     shadowRadius: 0,
     viewShadowColor: '#fff',
     viewShadowRadius: 24,
     text: 'A simple label',
     textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
     top: 30,
     width: Ti.UI.SIZE,
     height: Ti.UI.SIZE
 });

 win.add(label1);
 win.open();

and unfortunately it give me a rather dull effect. It is not very pleasing as the code only offset the layer 2 text a little and I have this effect.

enter image description here

please help. I am trying to get a sticker effect and not just a shadow of the text.

thanks

1 个答案:

答案 0 :(得分:0)

您可以在标签上使用attributedStrings添加样式:http://docs.appcelerator.com/platform/latest/#!/guide/Attributed_Strings