0

BlackBerryのListField行の背景として垂直グラデーションを表示したいと思います。これを実現するためにshadedFillPath関数を使用しましたが、失敗しました。

int[] cols = new int[]{0xFFFFFF, 0xEEEEEE,0xEEEEEE,0XDDDDDD };
int[] xInds = new int[]{0, Display.getWidth(), Display.getWidth(), 0};
int[] yInds = new int[]{focusRect.y, focusRect.y,    
this.getRowHeight()+focusRect.y,this.getRowHeight()+focusRect.y};
graphics.drawShadedFilledPath(xInds, yInds,null, cols, null);
4

2 に答える 2

1

これを試して

        int[] X_PTS = { 0, getPreferredWidth(),getPreferredWidth(),0};        
        int[] Y_PTS = { 0,0, getPreferredHeight(),getPreferredHeight()};        
        int[] drawColors = { Colors.CategoryFocusGradientStart, Colors.CategoryFocusGradientStart,
                             Colors.CategoryFocusGradientEnd, Colors.CategoryFocusGradientEnd };        
        try {            
            g.drawShadedFilledPath(X_PTS, Y_PTS, null, drawColors, null);        
        } catch (IllegalArgumentException e) {
            Log.Error(e,this,"Bad arguments.");
        }
于 2011-11-18T12:16:15.807 に答える
0

@rfsk2010の回答ではありませんが、ほぼ(yの0を変更する必要があります):

の中へ:

public void drawListRow(ListField listField, Graphics graphics,int index, int y, int width)

これを行う:

int[] X_PTS = { 0, getPreferredWidth(),getPreferredWidth(),0};        
int[] Y_PTS = { y, y, getPreferredHeight(),getPreferredHeight()};        
int[] drawColors = { Colors.CategoryFocusGradientStart, Colors.CategoryFocusGradientStart,
                     Colors.CategoryFocusGradientEnd, Colors.CategoryFocusGradientEnd };        
try {            
    graphics.drawShadedFilledPath(X_PTS, Y_PTS, null, drawColors, null);        
} catch (IllegalArgumentException e) {
    Log.Error(e,this,"Bad arguments.");
}
于 2012-02-09T09:15:43.757 に答える