Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2885] Top and bottom padding collapses for certain string lengths

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNeeds more info
Resolution Date2011-12-26T07:32:52.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterJohn Johnson
AssigneePaul Dowsett
Created2011-08-29T06:06:17.000+0000
Updated2016-03-08T07:47:50.000+0000

Description

Problem

There's a nice 10px padding around the label. If I modify the string length to 145 chars (happens at other lengths too), all of the sudden the top and bottom padding collapses. If I set a fixed width on the label it works. However, this isn't a good solution since I want the app to work in all screen dimensions.

Test case

var win = Ti.UI.createWindow({
  backgroundColor: 'white',
  fullscreen: false
});

var data = [];

for(var i=0;i<20;i++){
  var	descriptionRow = Ti.UI.createTableViewRow({
    height:100,
    className:'rows'
  });

  var descriptionLabel = Ti.UI.createLabel({
    top: 10,
    left: 10,
    right: 10,
    bottom: 10,
    // text: "If I set a fixed width on the label, it works as intended but that's not very dynamic. My app has to work for both iPhone and iPad"+i, // works correctly
    text: "jhgieg jieg jiefjiew jfijw idj ddjwi djwid jwid jdiwdj iwdj iwdjwidj widw dwijd iw jfiejf iefj iefjie fji ejfie fjeifjeifj eifj iedfkfo ekf oekf "+i, / padding collapses
    font: { fontSize: 16 }
  });

  descriptionRow.add(descriptionLabel);

  data.push(descriptionRow);
}

var tableView = Ti.UI.createTableView({
  data: data,
  style: Ti.UI.iPhone.TableViewStyle.GROUPED
});

win.add(tableView);
win.open();

Comments

  1. Paul Dowsett 2011-08-31

    John Please would you edit your ticket to use the markup formatting provided. Also, would you provide the build date/hash of the Titanium SDK you tested with? Then I can accept the ticket. Many thanks
  2. Paul Dowsett 2011-09-02

    John, I am closing this post. You are welcome to reopen it if you are able to do the corrections, and then I will move it to the main project. Thank you
  3. Paul Dowsett 2011-12-26

    John Personally, I try to use table rows with equal heights, or else they tend to look messy. Hence, to solve this, set the row height, as in the new test case code above. I will mark this ticket resolved for the moment - please reopen it if you don't agree. However, bear in mind that I will not be able to escalate it unless it follows the [How to Submit a Bug Report](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report) guide. Remember to include a link to your Q&A question, in which you asked the community about this, which is a prerequisite to raising tickets. Cheers
  4. Paul Dowsett 2012-02-17

    Closing due to inactivity. If this issue still exists, please raise a new ticket, including all the information in the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist) to ensure that we can escalate it quickly. Read [How to Submit a Bug Report](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report) if you have not read it before, and always start a ticket using the [JIRA Ticket Template](https://wiki.appcelerator.org/display/guides/JIRA+Ticket+Template). Thanks in advance

JSON Source