0

i write my custom listbox item style. I Create my itemstyle.style.

I want to port this style on Android Platform but don't work.

I Add in Resource and bitmap itemstyle.style with identifier "Resource1"

In my code

var
Item: TListboxItem;
Style: TFMXObject;

begin

 Item := TListboxItem.Create(nil);
 Item.Parent := ListBox1;


 Item.StyleLookup := 'Resource1';

 Item.Text := 'Item 1';
end;

How to do it? Thank's an advanced. Marco.

Bonci Marco
  • 301
  • 2
  • 5
  • 17

1 Answers1

1

Your style needs to be in a TStyleBook component on the form.

The StyleBook property of the form needs to reference the TStyleBook object.

The StyleLookup property needs to reference whatever is in the StyleName property of the topmost object your style element (which should be a child of the TStyleContainer.

If that doesn't help please show the structure of your style file.

Mike Sutton
  • 4,191
  • 4
  • 29
  • 42
  • Hi Mike, the problem is: How to load my style item on android? In Windows I load the file .style on the Resource (TStyleManager) on TStylebook....but in Android Plataform don't works. How to do itù? – Bonci Marco Aug 20 '14 at 19:29
  • This works fine for me: Click the ... on the Resource property (of the TStyleBook) in the object inspector, Load the file, click Apply and Close. You'll have to explain *exactly* what doesn't work. – Mike Sutton Aug 22 '14 at 20:47
  • The Style is not visible to android plataform. I resolved it temporary with resource1.Resource.LoadFromFile(TPath.Combine(TPath.GetDocumentsPath, 'itemstyle.style')); but the first in deployment add in assets/internal itemstyle.style...Thank's for help. Marco. – Bonci Marco Aug 23 '14 at 14:32