滚动问题与位图图像字段,黑莓

时间:2010-03-04 10:34:42

标签: blackberry java-me

在BB 9000上工作

嘿,在我的屏幕上有一个标签字段,在它下面有一个位图字段,下面有一个列表字段

当我向下滚动时,所有重新绘制都很好,但是当我从列表字段向上滚动到位图字段

然后我的图像不会重新粉刷,直到我到达最顶部的标签字段。

我无法弄清楚为什么会发生

由于某些原因,标签字段设置为可聚焦...

使位图字段成为可聚焦的也不能解决问题

代码:

LabelField lbl = new LabelField("Hello",Field.focussable)

detail_img = Bitmap.getBitmapResource("container.png");
detail_img_field = new BitmapField(detail_img);

 reviewlist =  new Review_List(my_vector); //Review_List is  a class that fills value in list field

 reviewlistManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL |Manager.VERTICAL_SCROLLBAR)
 {              

                 protected void paint(net.rim.device.api.ui.Graphics graphics)
                    {
                         super.paint( graphics );
                    }

                      protected boolean keyDown( int keycode, int status )
                        {
                           my_Screen.this.invalidate();
                            return super.keyDown( keycode, status );
                        }
                        protected boolean keyUp(int keycode, int time)
                        {
                            my_Screen.this.invalidate();
                            return super.keyUp(keycode, time);
                        }

                        protected boolean navigationMovement( int dx, int dy, int status, int time )
                        {
                            my_Screen.this.invalidate();
                            return super.navigationMovement( dx, dy, status, time );
                        }

                        protected int moveFocus(int amount, int status, int time)
                        {
                            my_Screen.this.invalidate();
                           return super.moveFocus(amount, status, time);
                        }
                        protected void onFocus(int direction)
                        {
                            my_Screen.this.invalidate();
                            super.onFocus(direction);
                        }
                        protected void onUnfocus() 
                        {
                            my_Screen.this.invalidate();
                            super.onUnfocus();
                        }

                };

reviewlistManager.add(reviewlist);
backgroundMannager.add(reviewlistManager);
add(backgroundMannager);

2 个答案:

答案 0 :(得分:1)

这是在模拟器还是真实设备上?有时模拟器会出现渲染问题(例如不重绘它们应该具有的区域),而真实设备却没有。

答案 1 :(得分:1)

yuppieeeeee

我得到了答案

我刚刚将位图字段放在VerticalFieldManager中,启用了垂直滚动n我的问题得到了解决...

代码:

    rest_manager = new VerticalFieldManager(Manager.VERTICAL_SCROLL)
          {
            protected void paint(net.rim.device.api.ui.Graphics graphics)
             {
                  int y = this.getVerticalScroll();                                     
                                     graphics.drawBitmap( 0, y, rank_img.getWidth()+10, 
rank_img.getHeight(), rank_img, 0, 0 );

                                     super.paint( graphics );
                                }
                     }