Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 13
Registered: ‎11-30-2012
My Device: Alpha
My Carrier: Pepephone

ActionItem not showing image

I have an actionItem with a image, set as:

 

ActionItem* aItem1 = ActionItem::create().title(tr("Search"));
	aItem1->setImage(Image("asset:///images/iconobuscar2.png"));
	

Where the PNG is and image size 57x57 with the padding recomended, so the total size is 87x87. The image is a white image with transparent background. I have also tryed with a JPG, but it doesn't work either

 

The problem is that the image is not shown. Just a black space is shown. Any idea?

Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: ActionItem not showing image

Most likely it's unable to find the image.

 

The following code works for me:

copyAction_ = ActionItem::create()
  .imageSource(QUrl("asset:///images/iconsbb/ic_copy.png"))
  .title("Copy");
addAction(copyAction_, ActionBarPlacement::OnBar);

 In bar-descriptor.xml I have:

<asset path="%SRC_DIR%/assets">assets</asset>

 The image path is assets/images/iconsbb/ic_copy.png

 


Andrey Fidrya, @zmeyc on twitter
Highlighted
Contributor
Posts: 13
Registered: ‎11-30-2012
My Device: Alpha
My Carrier: Pepephone

Re: ActionItem not showing image

With imageSource woks perfect!!! Strange. Don't know if is a bug, because setting the image as before, doesn't work