[TIMOB-24479] Android: maxLines not working for Ti.UI.Label (regression)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-03-15T22:42:30.000+0000 |
Affected Version/s | Release 6.0.2 |
Fix Version/s | Release 6.0.3 |
Components | Android |
Labels | android, label, maxlines |
Reporter | Carlos Henrique Zinato |
Assignee | Frankie Merzadyan |
Created | 2017-03-13T12:06:51.000+0000 |
Updated | 2017-03-20T08:57:15.000+0000 |
Description
Label's property maxLines seems not to work since SDK 6 on Android.
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Label-property-maxLines
I've tested it on SDK 5.1.x and 5.5.x and it does work.
On 6.0.2.GA, or 6.1.0.v20170312111734 it DOES NOT work.
The funny thing is that it works correctly when the Label is inside a List Item template.
here is a test code:
var win = Ti.UI.createWindow({
theme: "Theme.AppCompat.Fullscreen",
backgroundColor: '#fff'
});
var longString = "Welcome to the Appcelerator Platform! The Appcelerator Platform extends Appcelerator's Titanium platform to help you manage the entire lifecycle of the application with debugging, testing, deployment, crash monitoring and analytic data collection.";
var bigLabel = Ti.UI.createLabel({
text:longString,
color:'#4d4d4d',
width:'90%',
top:10,
lines:1
});
win.add(bigLabel);
bigLabel.setMaxLines(1);
var myTemplate = {
childTemplates: [
{
type: 'Ti.UI.Label',
bindId: 'info',
properties: {
color:'#4d4d4d',
left:0,
maxLines:1
}
}
]
};
var listView = Ti.UI.createListView({
top:300,
width:'90%',
templates: { 'template': myTemplate },
defaultItemTemplate: 'template'
});
var sections = [];
var fruitSection = Ti.UI.createListSection();
var fruitDataSet = [
{
info: { text: longString }
},
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
listView.setSections(sections);
win.add(listView);
win.open();
Attachments
File | Date | Size |
---|---|---|
maxLines.png | 2017-03-13T12:06:22.000+0000 | 75123 |
Hello, I can verify the issue in Android 6.0.1 with SDK 6.0.2.GA. maxLines not working for labels.
master: https://github.com/appcelerator/titanium_mobile/pull/8884. 6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8885
Nice! Thanks Frankie! How should I proceed to use this fix in my code? Wait for a new release?
[~chmiiller] The fix is openly available so, if you wish, you can pull and build it to see if it fixes your problem but it's currently in the review and testing phase by our developers and testers so I recommend waiting to hear what the final verdict is at least and I think a 6.0.3 release is coming soon if you decide to wait for the release. I hope that was informational.
Fix is present in 6.0.3.v20170315154238. Test steps and information can be found at https://github.com/appcelerator/titanium_mobile/pull/8885
Fix also present it 6.1.0.v20170317060325. Test steps and information can be found at https://github.com/appcelerator/titanium_mobile/pull/8884
Yes it is @Frankie! Thank you so much. Gonna start using 6.0.3! Thanks