Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23140] Android: Add lineSpacing property to Label

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-04-06T11:41:16.000+0000
Affected Version/sRelease 5.2.1
Fix Version/sRelease 5.4.0
ComponentsAndroid
Labelsandroid, label
ReporterMichael Gangolf
AssigneeAshraf Abu
Created2016-04-02T15:52:00.000+0000
Updated2016-05-27T21:02:02.000+0000

Description

Add {noformat} lineSpacing: {add: float, multiply: float} {noformat} to Label !http://migaweb.de/linespacing.png! Android doc: http://developer.android.com/reference/android/widget/TextView.html#setLineSpacing%28float,%20float%29 *Example:*
var win = $.UI.create("Window", {
    layout: "vertical",
    backgroundColor: "#fff"
});

var l = $.UI.create("Label", {
    lineSpacing: {
        add: 20,
        multiply: 1
    },
    text: "asdfasdfasdf\nasfasfasfasfafsd\nasfasfasdfasdf\nadsfasdfasdf",
    height: Ti.UI.SIZE,
    width: Ti.UI.SIZE,
    backgroundColor:"red"
});

var l2 = $.UI.create("Label", {
    lineSpacing: {
        add: 0,
        multiply: 1
    },
    text: "qwerqwerqwer\nqwerqwer\nqwerqwerqwe\nqwerqwerqwre",
    height: Ti.UI.SIZE,
    width: Ti.UI.SIZE,
    backgroundColor:"green"
});

var l3 = $.UI.create("Label", {
    lineSpacing: {
        add: 10,
        multiply: 0
    },
    text: "yxcvyxcyvx\nycxvyxcvyxc\nyxvcyxcvyxcv\nyxcvyxvyxc\nyxcvyxcvyx",
    height: Ti.UI.SIZE,
    width: Ti.UI.SIZE,
    backgroundColor:"yellow"
});

win.add(l);
win.add(l2);
win.add(l3);
win.open();

Comments

  1. Michael Gangolf 2016-04-02

    PR: https://github.com/appcelerator/titanium_mobile/pull/7909
  2. Michael Gangolf 2016-04-02

    getter/setter:
       label.setLineSpacing({
           add: 20,
           multiply: 2
       });
       
       console.log(label.getLineSpacing());
       
  3. Ashraf Abu 2016-04-04

    Thank you for the PR.
  4. Lokesh Choudhary 2016-05-27

    Verified the implementation & it works as expected. Closing. Environment: Appc Studio : 4.6.0.201605180604 Ti SDK : 5.4.0.v20160526011354 Ti CLI : 5.0.8 Alloy : 1.8.7 MAC El Capitan : 10.11.4 Appc NPM : 4.2.5-5 Appc CLI : 5.3.0-47 Node: 4.2.2 Nexus 6 - Android 6.0.0

JSON Source