0

I have a list view that stretch to device width that shows a list of names, I need to make the label fit the total width, just like autofit. So if its a short name it should have max font to fit to view width or if its a long name the font size should decrease to fit the view width. Blackberry 10.2 has a autofit property on label that does this but I need it to support from 10.0. So is there any other alternative to do this?

This is my current definition of the label

Label {
                    id: myLabel   
                    horizontalAlignment: HorizontalAlignment.Fill
                    verticalAlignment: VerticalAlignment.Center
                    textStyle {
                        base: tsLabel.style
                    }


 TextStyleDefinition {
            id: tsLabel
            base: SystemDefaults.TextStyles.BodyText
            fontSize: FontSize.PointValue
            fontSizeValue:14
            color: Color.White
            fontWeight: FontWeight.Bold

        }
Francis F
  • 3,157
  • 3
  • 41
  • 79
  • First of all, why does label size matter in a ListView? Do you have it horizontal? Second of all, there are around 5% of 10.0 and 10.1 users, I dropped support for that OS long ago http://news.ebscer.com/2014/12/most-blackberry-users-still-waiting-for-os-10-3/ – Bojan Kogoj Dec 24 '14 at 09:50
  • The listview component is a custom component that shows a users profile pic on left and details on right. So if I give a fixed size for some users who have long detail the label gets cuts off. – Francis F Dec 24 '14 at 11:20
  • But if label is too long it will look weird, why not use multiline? – Bojan Kogoj Dec 24 '14 at 13:17
  • It's not the answer to your question but please do not do this. I would rather have cut off info than look at the list with several font sizes for the same thing. Take a look at UI guidelines for BlackBerry 10. – pajaja Dec 27 '14 at 21:39

0 Answers0