B4J Question [ABMaterial] How to center the text on ABMCard

Anser

Well-Known Member
Licensed User
Longtime User
Hi,

Is it possible to Horizontal Center the text on ABMCard. Would be nice if we could center the text Horizontally as well as Vertically too
For Eg.

B4X:
' basic card
Dim year As ABMCard
year.InitializeAsCard(page, "year", "{B}This Year{/B}", "0", ABM.CARD_SMALL,"whitetitle")
year.Image = "../images/sample-1.png"
year.Size = 20

This is how it is appearing now
Card.png


I want this to appear as given below (Horizontally and Vertically Centered)
Card3.png


Any help will be appreciated.

Regards

Anser
 
Last edited:

Anser

Well-Known Member
Licensed User
Longtime User
Card3.png


I am trying to get the above done via ABMCustomCard, but I am stuck at having a transparent Label on top of the ABMImage.

This is actually a DashBoard which picks data from the database and then display on the DashBoard

The Blue colored background seen above is an Image. I would like to place a text on top of the Image ie the text "This Year". The contents of this text label would change progrmatically during run time.

In the ABMCustomCard's properties, I found that, to place views on the ABMCustomCard, the following METHODS are available

Card.SetFrontTopComponent()
Card.SetFrontTitleComponent()
Card.SetBackComponent() 'This is for different purpose

B4X:
Dim year As ABMCustomCard
year.Initialize(page, "year", ABM.COLOR_BLUE)
year.UseTheme("whitetitle")

Dim Image As ABMImage
Image.Initialize(page, "Image", "../images/sample-1.png",1)
year.SetFrontTopComponent(Image)
 
'Creating a transparent label
Dim FrontTitle As ABMLabel
FrontTitle.Initialize(page,  "fronttitle", "{B}This Year{/B}", ABM.SIZE_H6, True, "lbltranparent")

'Do not know how to place this label over the ABMImage  
day.SetFrontTopComponent(FrontTitle)

Another thing that I am looking for is a click event on the ABMCustomCard. Of course I can add a Action Button to simulate a click event, but then the user has to click on that button, instead of the Card
 
Upvote 0
Top