我感觉到它与图像路径有关,而不是检测图像。我是黑莓开发的新手。

该应用程序运行,但图像未显示。也许图像定位不正确?

public final class Welcome extends MainScreen
{
    /**
     * Creates a new Welcome object
     */
    public Welcome()
    {
        // Set the displayed title of the screen
        setTitle("Select a brand");

        Bitmap bitmapImage = Bitmap.getBitmapResource("/BrowserBlackberry/res/img/Celsian.jpg");
        BitmapField fieldDemo = new BitmapField(bitmapImage);
        fieldDemo.setBorder(150,getBorder(20));
        fieldDemo.getBackground(Background.POSITION_X_CENTER);

        add(fieldDemo);
    }
}

最佳答案

尝试这个

 public Welcome()
{
    // Set the displayed title of the screen
    setTitle("Select a brand");

    Bitmap bitmapImage = Bitmap.getBitmapResource("Celsian.jpg");
    BitmapField fieldDemo = new BitmapField(bitmapImage);
    add(fieldDemo);

}

10-04 17:50