2011-11-18 3 views
0

BlackBerry에서 ListField 행의 배경으로 수직 기울기를 표시하려고합니다. 나는 이것을 달성하기 위해 shadedFillPath 기능을 사용하지만, 실패 :Blackberry의 ListFieldItem에 대한 수직 기울기

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); 

답변

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."); 
     } 
0

그것의하지에서 @ rfsk2010 대답을하려고 노력하지만, 거의 (당신은 0의 Y에 대한 것으로 변경해야합니다) :

속으로 :

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."); 
}