-
Notifications
You must be signed in to change notification settings - Fork 192
Image List
Image lists give the user different options that they can choose. This user interface can seen in the BlackBerry options area.
Creating an image list is really simple and begins with creating a <div> that has the attribute data-bb-type="image-list". Each item in the list is another
<div> that has the attribute data-bb-type="item". Each item has an image (data-bb-img), a title (data-bb-title), accent text that floats in the top right (data-bb-accent-text), and a description which is the inner contents
of the <div>. An image list can have both headers and line items. A header is declared by creating a <div> with a data-bb-type="header" attribute and the contents of the header are displayed as the label.
Headers have their text centered by default. To left justify your header text add the data-bb-justify="left" or to right justify your text add the **data-bb-justify="right"**attribute to your header.
- BlackBerry 5 & 6 - 60 x 60 pixels
- BlackBerry PlayBook & BlackBerry 7 - 70 x 70 pixels
- BlackBerry PlayBook with BB10 styling - 64 x 64 pixels
- BlackBerry 10 - 119 x 119 pixels
`
<div data-bb-type="screen">
<div data-bb-type="image-list" data-bb-context="true">
<div data-bb-type="header">My sample header</div>
<div data-bb-type="item" data-bb-img="icon1.png" data-bb-title="Input Controls">Use native looking input controls</div>
<div data-bb-type="item" data-bb-img="icon2.png" data-bb-title="Inbox List">Style your list like the BlackBerry Inbox</div>
<div data-bb-type="item" data-bb-img="icon3.png" data-bb-title="Settings">Create native looking options screens</div>
<div data-bb-type="header">Look at me</div>
<div data-bb-type="item" data-bb-img="icon6.png" data-bb-title="BBM Bubbles">Generate a chat window like BBM</div>
<div data-bb-type="item" data-bb-img="icon7.png" data-bb-title="Pill Buttons">Use pill buttons to organize your data</div>
<div data-bb-type="item" data-bb-img="icon8.png" data-bb-title="Charts">Add charts to your application</div>
<div data-bb-type="item" data-bb-img="icon9.png" data-bb-title="Guages">Use gauges and progress bars</div>
<div data-bb-type="item" data-bb-img="icon10.png" data-bb-title="Tab Controls">Use tabs to organize your data</div>
<div data-bb-type="item" data-bb-img="icon11.png" data-bb-title="Arrow List">Create a navigation list with arrows</div>
</div>
</div>
` To add a click event to one of the line items, simply add an onclick event to the <div>
<div data-bb-type="item" onclick="alert('clicked')" data-bb-img="icon9.png" data-bb-title="Guages">Use gauges and progress bars</div>
NOTE: Image Options and Effects are only available currently in the "next" branch
If you want a simple list without images you can set the data-bb-images="none" attribute on your image list
<div data-bb-type="image-list" data-bb-images="none">
</div>
You can also specify placeholder images that are used for when you don't have an image to represent the list item, or if the url to your list item is broken. This can be done by setting the data-bb-image-placeholder attribute with the path to your placeholder image
<div data-bb-type="screen">
<div data-bb-type="image-list" data-bb-context="true">
<div data-bb-type="item" data-bb-title="Title">No Image</div>
<div data-bb-type="item" data-bb-img="/unreachable/image.png" data-bb-title="Title">Unreachable</div>
</div>
</div>
On BlackBerry 10 you can also specify an image effect for how your images will show up in your list. This can be done by setting the data-bb-image-effect="fade" attribute for your image list. Each of the images will fade in once they have been loaded.
<div data-bb-type="image-list" data-bb-image-effect="fade">
</div>
If you want to attach a BlackBerry 10 context menu to your image list you can add the data-bb-context="true" attribute. This will automatically hook up your image list to the press and hold context menu that you have declared for the screen. When the image list item is pressed and held for 667ms it will peek the screen's context menu passing the title and description of the list item along with a handle to the item element. See the Context Menu area for more details of interacting with the menu.
NOTE: The context menu integration with the image list only works on BlackBerry 10