0

我是 BB 开发的初学者。我创建了一个 CustomListField,当我单击一行时,该行的背景颜色必须更改并且必须显示一个新屏幕(完成!)。

任何人都可以帮我完成这项工作吗?谢谢

下面是代码:

protected boolean navigationClick(int status, int time)
       {Field field = this.getLeafFieldWithFocus();

       if(field instanceof ListField)
       {
         // listValues is String[] where you store your list elements.
         // listField is the ListField instance you are using 
           UiApplication.getUiApplication().pushScreen(new ReadMsgScreen());

           int index= getIndex();
           if(index== this.getSelectedIndex())
           {
               **// I think the  code to change the row's background color must be set here!**

           }

          return true;
        }

       return super.navigationClick(status, time);
   }
4

3 回答 3

1

使用它它肯定会工作......

int tmpcolor = graphics.getColor();
graphics.setColor(Color.CYAN);
graphics.fillRect(0, y, width, getRowHeight());
graphics.setColor(tmpcolor);

谢谢...

于 2011-08-11T11:18:38.953 回答
0

onerride 黑莓中的paint() 方法,如下面的代码所示。

_specialNumbers = new LabelField(Constants.SPECIAL_NUMBERS,LabelField.USE_ALL_WIDTH) {
            protected void paintBackground(Graphics arg0) {
                int color = arg0.getBackgroundColor();
                arg0.setBackgroundColor(Color.LIGHTGREY);
                arg0.clear();
                arg0.setBackgroundColor(color);
            }
        };
于 2011-08-11T10:54:34.463 回答
0

In the drawListRow() method of the ListFieldCallback for your CustomListField draw that selected line differently and call a Transition to display the other Screen slowly.

于 2011-08-12T21:56:30.853 回答