Home Firemonkey TListView - Adjust item text margins
Reply: 1

Firemonkey TListView - Adjust item text margins

Jerry Dodge
Jerry Dodge Published in 2017-11-09 15:25:31Z

I'm implementing a TListView in a Firemonkey app, where the height of each list item must be as small as possible, just large enough to fit the text. However, there is an apparent margin on the top of the text, leaving an empty space at the beginning of each list item.

The item appearance is set to ListItemRightDetail, but I cannot find any properties anywhere to allow me to control this - neither in the FMX design or the Styles for the List View.

How do I eliminate the margin at the top of list item text so that I can minimize the list item heights?

Jerry Dodge
Jerry Dodge Reply to 2017-11-09 15:25:31Z

There are not necessarily any "margin" properties, as this margin is pretty much built-in. However, this can be adjusted by modifying the PlaceOffset.Y property, and making them a negative value. This will "lift up" the contents within each list item. I find -3 to be a sufficient amount to reduce this margin...

ListView1.ItemAppearanceObjects.ItemObjects.Text.PlaceOffset.Y := -3;
ListView1.ItemAppearanceObjects.ItemObjects.Detail.PlaceOffset.Y := -3;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.450917 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO