firemonkey ListView DynamicAppearance

Go Up to FireMonkey Application Design

You can customize the appearance of a FireMonkey list view by modifying the layout of the list items, including the caption, the associated image, text details, or the accessory icon.

AndroidScreen.pngLBListView Android.png 

Customizing the List View Appearance Properties

At design time, you can change the footer, header, and the list items appearance (also for the editing mode) by modifying the values of the properties in the ItemAppearance property. The ItemAppearance property controls the footer, the header, and the item appearance size (normal and in editing mode).

The following appearance properties of a ListView are grouped in the Object Inspector and in the StructureView, and you can modify their values to customize your list view appearance.

Footer properties

  • FooterHeight. This property designates the list footer height (in pixels). Default value: 24.
  • FooterAppearance. This property designates the footer graphical appearance. Possible values are: Custom and ListHeader. Default value: ListHeader.

Header properties

  • HeaderHeight. This property designates the list header height (in pixels). Default value: 24.
  • HeaderAppearance. This property designates the header graphical appearance. Possible values are: Custom and ListHeader. Default value: ListHeader.

List item properties

  • ItemHeight. This property designates the item height (in pixels). Default value: 44.
  • ItemAppearance. This property designates the item graphical appearance (image, caption, accessory button, etc.). Default value: ListItem.
Choose between the following values:
PropertyVisible objects
CustomSee Using the Custom Value
DynamicAppearanceSee Using the DynamicAppearance Value
ImageListItemAn image, a caption, and an accessory graphical button
ImageListItemBottomDetailAn image, a caption, a detail text, and an accessory graphical button
ImageListItemBottomDetailRightButtonAn image, a caption, a detail text, and an accessory text button
ImageListItemRightButtonAn image, a caption, and an accessory text button
ListItemA caption and an accessory graphical button
ListItemRightDetailA caption, a detail text, and an accessory graphical button

See FMX.ListViewCustomBottomDetail Sample and other Samples.

Edited list item properties

  • ItemEditHeight. This property designates the item height (in pixels) when in edit mode. Default value: 44.
  • ItemEditAppearance. This property designates the item graphical appearance when in edit mode. Default value: ListItemShowCheck.
Choose between the following values:
PropertyVisible objects
CustomSee Using the Custom Value
DynamicAppearanceSee Using the DynamicAppearance Value
ImageListItemBottomDetailRightButtonShowCheckAn image, a caption, a detail text, a check box glyph button, and a text button
ImageListItemBottomDetailShowCheckAn image, a caption, a detail text, a check box glyph button, and an accessory graphical button
ImageListItemDeleteAn image, a caption, a delete glyph button, and an accessory graphical button
ImageListItemRightButtonDeleteAn image, a caption, a delete glyph button, and a text button
ImageListItemRightButtonShowCheckAn image, a caption, a check box glyph button, and a text button
ImageListItemShowCheckAn image, a caption, a check box glyph button, and an accessory graphical button
ListItemDeleteA caption, a delete glyph button, and an accessory graphical button
ListItemRightDetailDeleteA caption, a detail text, a delete glyph button, and an accessory graphical button
ListItemRightDetailShowCheckA caption, a detail text, a check box glyph button, and an accessory graphical button
ListItemShowCheckA caption, a check box glyph button, and an accessory graphical button

See FMX.ListViewCustomBottomDetail Sample and other Samples.

How to Modify List View Appearance Properties

Use the StructureView and the Object Inspector to find the List View component.

ItemAppearenceValueListView.png 

 

Customizable Item Appearances

The DynamicAppearance and Custom values allows you to customize the appearance of the items in a ListView. You can use the Customvalue for the FooterAppearanceHeaderAppearanceItemAppearance and ItemEditAppearance properties of the items in the ListView, while you can use the DynamicAppearance for the ItemAppearance and ItemEditAppearance properties of the items in the ListView. You can also use built-in search filtering with the DynamicAppearance mode (*added in Subscription Update 1).

Using the DynamicAppearance Value

The DynamicAppearance allows you to dynamically customize the item appearance of the ListView at design time. The difference between DynamicAppearance and the other item appearance properties is that the DynamicAppearance allows you to add as many objects as you want to the appearance of your item.

By default, the DynamicAppearence contains a single text object. To add more objects, select Item from IteamAppearance in theStructureView. Then, in the Object Inspector, click the + property and select any of the available objects. The available objects are:

DynamicAppearence.png

You can customize the objects of the item appearance at design time by selecting an object in the StructureView and changing its properties in the Object Inspector. Among the things you can customize, these are some examples: the font type, text size or text alignment in text objects or the button type in button objects. Moreover, you can visually customize the objects of the item appearance enabling the Toggle DesignMode.

Tip: As you can add as many objects as you want, it is highly recommended to use the  DynamicAppearance with the  Toggle DesignMode enabled.

Using the Custom Value

Selecting the Custom appearance value enables the following objects in the item appearance:

CustomValueStructure.png

To set the visibility of the desired objects:

  • Enable the Visible property (by setting its value to True) in the Object Inspector for any of the desired objects and modify the properties according to your needs.
  • Enable the Visible property for any of the objects, by setting it to True in the source code.

Delphi:

AItem.Objects.AccessoryObject.Visible := True;

C++:

void __fastcall TForm1::SetEditItemProperties( TItemAppearanceObjects * AObjects)
{
	AObjects->GlyphButton->Visible = true;
}

The Toggle Design Mode

The Toggle DesignMode allows you to visually customize the item appearance of a ListView at design time. You can select this mode for any ItemAppearance property (CustomDynamicAppearanceListItemImageListItem, etc.).

Tip: The  Toggle DesignMode is highly recommended when using the  DynamicAppearance because the  DynamicAppearance allows you to freely customize the  ItemAppearance.

To select the Toggle DesignMode, right-click the TListView object in the StructureView or in the TForm and select it. The Toggle DesignMode changes the design-time view of the ListView object from a blank box to a design preview of the ListView item. Then, you can:

  • Visually customize the item appearance in the form.
  • Visualize the changes that you make to the item appearance properties using the Object Inspector.
ToggleDesignMode.png

Create a Customized Appearance Class

You can create and install a new customized appearance class and use it in your design, by installing a new package. This package defines the classes that implement a custom appearance for list view items. You can customize the fields as necessary, to implement a rating image for instance (a control that shows a different image based on a numeric value).

How to use the Customized Appearance Class

  1. Implement a new TListView appearance package. The following samples contain different examples that customize the list view appearance to show:
  2. Install the customized appearance package in the IDE.
  3. Once installed, the new appearance can be used with a TListView component in the Object Instpector.

CustomizedAppearancePackage.png

Note: The  MultiDetailItem value is a customized appearance package, previously installed in the IDE.

See Also

Samples

转载于:https://www.cnblogs.com/zhqian/p/7355104.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值