我使用以下代码来显示丰富列表。
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.system.*;
import net.rim.device.api.ui.component.table.*;
public class RichListDemo extends UiApplication
{
public static void main(String[] args)
{
RichListDemo theApp = new RichListDemo();
theApp.enterEventDispatcher();
}
public RichListDemo()
{
pushScreen(new RichListScreen());
}
private static class RichListScreen extends MainScreen
{
public RichListScreen()
{
super(Manager.NO_VERTICAL_SCROLL);
setTitle("Rich List Demo");
add(new LabelField("BlackBerry Devices", LabelField.FIELD_HCENTER));
add(new SeparatorField());
Manager mainManager = getMainManager();
RichList list = new RichList(mainManager, true, 2, 1);
Bitmap bitmap1 = Bitmap.getBitmapResource("9500.png");
Bitmap bitmap2 = Bitmap.getBitmapResource("9000.png");
list.add(new Object[] {bitmap1, "Device 1", "BlackBerry Smartphone 9500", "Description of Device 1."});
list.add(new Object[] {bitmap2, "Device 2", "BlackBerry Smartphome 9000", "Description of Device 2."});
}
}
}
如何实现富豪榜的点击事件?当我单击列表时,我想显示一个对话框。有可能吗?
最佳答案
您无法确定 RichList
中选定的行。如果您想要具有点击功能,可以使用 TableView
而不是 RichList
。 RichList
应用于您想要显示的只读项目。如果您想捕获输入和/或允许用户进行选择,则应使用 TableView
。
您可以使用this用于创建 TableView 并在行中添加可点击字段的链接
关于blackberry - 丰富列表点击事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9095403/