我不知道为什么,但我无法在我的黑莓应用程序中显示 bitmapField。位图从不渲染。
这是代码:图像放在res文件夹中:
package mypackage;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;
/**
* A class extending the MainScreen class, which provides default standard
* behavior for BlackBerry GUI applications.
*/
public final class MyScreen extends MainScreen
{
BitmapField bitmapField;
/**
* Creates a new MyScreen object
*/
public MyScreen()
{
Bitmap logoBitmap = Bitmap.getBitmapResource("res/apresslogo.png");
bitmapField = new BitmapField(logoBitmap,Field.FIELD_HCENTER);
add(bitmapField);
// Set the displayed title of the screen
setTitle("MyTitle");
}
}