私はBB devの初心者です。私はCustomListFieldを作成し、行をクリックすると、この行の背景色が変更され、新しい画面が表示されなければなりません(完了です)。ナビゲーション後にListFieldの行の色の背景を変更する方法をクリックします。
これを行うには手伝ってください。 THX以下
コードです:
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);
}
ListField行のpaint()メソッドを呼び出す必要があります。 'int index = getIndex(); 場合(インデックス== this.getSelectedIndex()){ **私はここで設定する必要があり、行の背景色を変更するコードを考えて// ** !}私はpaint()メソッドをオーバーライドすることを試みた ' – Manel
: 'TableRowManager ele_row =新しいTableRowManager() \t \t \t { \t \t \t \t保護ボイドペイント(グラフィックスグラフィック){ \t \t \t \t \t無効()。 \t \t \t \t \t graphics.setBackgroundColor(Color.RED); \t \t \t \t \t super.paint(graphics); \t \t \t \t} \t \t \t}それでもまだ動かない!!誰でもリストフィールドの行の背景色を変更する方法について考えていますか? – Manel
この問題の解決策は 'g.setBackgroundColor(0x33CCFF);を追加することです。 'drawRow(Graphics g、int x、int y、int width、int height)'メソッドの直前の 'g paint.graph'(g);メソッドの直前のメソッドです。' public void drawRow(Graphics g、int x、int y、int width、int height){layout(width、height); setPosition(x、y); g.pushRegion(getExtent()); g.setBackgroundColor(0x33CCFF); g.clear(); g.setColor(Color.BLACK);サブペイント(g); – Manel