Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Image 如何在BlackBerry的UIC应用程序上显示图像?_Image_Blackberry_Uiapplication - Fatal编程技术网

Image 如何在BlackBerry的UIC应用程序上显示图像?

Image 如何在BlackBerry的UIC应用程序上显示图像?,image,blackberry,uiapplication,Image,Blackberry,Uiapplication,如何在UIC应用程序上显示图像 我有一个显示按钮的代码,单击它会进入主屏幕,但我想在该按钮下方显示一个图像。我找到了一种插入可缩放图像的方法,但不是静态图像 以下是我目前的代码: 公共类HelloWorldDemo扩展UiApplication{ 专用主屏幕(u屏幕),; 私有按钮场_nextScreen; 公共静态void main(字符串[]args){ HelloWorldDemo实例=新建HelloWorldDemo(); enterEventDispatcher(); } 公共Hell

如何在UIC应用程序上显示图像

我有一个显示按钮的代码,单击它会进入主屏幕,但我想在该按钮下方显示一个图像。我找到了一种插入可缩放图像的方法,但不是静态图像

以下是我目前的代码:

公共类HelloWorldDemo扩展UiApplication{
专用主屏幕(u屏幕),;
私有按钮场_nextScreen;
公共静态void main(字符串[]args){
HelloWorldDemo实例=新建HelloWorldDemo();
enterEventDispatcher();
}
公共HelloWorldDemo(){
EncodedImage myImg=EncodedImage.getencodedimagesource(“k.jpg”);
ZoomScreen zoomableImg=新的ZoomScreen(myImg);
_屏幕=新的主屏幕();
_nextScreen=新建按钮字段(“转到下一屏幕”,按钮字段.FIELD|HCENTER |按钮字段.消费|单击);
_nextScreen.setChangeListener(新的FieldChangeListener(){
公共无效字段已更改(字段,int上下文){
推屏(新的NextScreen());
}
});
_screen.setTitle(新LabelField(“Hello World Demo”,LabelField.USE_ALL_WIDTH));
_screen.add(newrichtextfield(“黑莓世界你好!”,Field.NON_FOCUSABLE));
_screen.add(_nextScreen);
推屏(U屏);
推屏(缩放);
}
}

使用
位图字段
显示图像。API链接在这里
myImg.getBitmap()
将返回一个
Bitmap
,该位图可用于创建
BitmapField
。感谢您的帮助..我以您的为例从头重写了代码,现在它开始工作了。。。
//I'm confused about your question. But still I'm posting ans here hope it will help you.
public final class ZoomScreenDemo extends UiApplication
{
    public static void main(final String[] args)
    {
        UiApplication app = new ZoomScreenDemo();
        app.enterEventDispatcher();
    }


    public ZoomScreenDemo()
    {
        pushScreen(new ZoomScreenDemoScreen());
    }


    public final static class ZoomScreenDemoScreen extends MainScreen
    {    
        private EncodedImage _image;   
        private ButtonField _nextScreen;

        public ZoomScreenDemoScreen()
        {           
            setTitle("Zoom Screen Demo");          

            _nextScreen = new ButtonField("Go to next screen ",ButtonField.CONSUME_CLICK);
            _nextScreen.setChangeListener(new FieldChangeListener() {

                public void fieldChanged(Field field, int context) {
                     UiApplication.getUiApplication().pushScreen(new DemoZoomScreen(_image));
                }
            });

            add( _nextScreen );
            _image = EncodedImage.getEncodedImageResource("img/building.jpg");        
            BitmapField bitmapField = new BitmapField(_image.getBitmap(), FIELD_HCENTER | FOCUSABLE);
            add(bitmapField);            
        }       
    }    



    static class DemoZoomScreen extends ZoomScreen
    {    
        DemoZoomScreen(EncodedImage image)
        {
            super(image);
        }

        public void zoomedOutNearToFit()
        {            
            close();
        }    
    }
}