【问题标题】:How to change the highlighter(blue) in a blackberry application?如何更改黑莓应用程序中的荧光笔(蓝色)?
【发布时间】:2013-03-06 14:37:30
【问题描述】:

黑莓的默认高亮颜色是蓝色。我目前正在做一个主色是红色的应用程序。有没有办法将荧光笔颜色更改为红色?我用谷歌搜索并找到了 ListField 的解决方案,对于其他字段,如按钮、textFields、bitmapFields 等...?

【问题讨论】:

    标签: blackberry java-me highlighting onfocus


    【解决方案1】:

    在黑莓论坛上找到了这个实现,试过了,效果很好。但是您需要为每个想要使用不同荧光笔的字段覆盖此方法。

    protected void drawFocus( Graphics g, boolean on ) {    
        XYRect focusRect = new XYRect();                
        getFocusRect( focusRect );                
        int yOffset = 0;                
    
        if ( isSelecting() )     
        {        
            yOffset = focusRect.height >> 1;        
            focusRect.height = yOffset;        
            focusRect.y += yOffset;    
        }                
        g.pushRegion( focusRect.x, focusRect.y, 
                      focusRect.width, focusRect.height, 
                      -focusRect.x, -focusRect.y );   
        g.setBackgroundColor(/*your color here*/);    
        g.setColor( 0xFFFFFF );    
        g.clear();                
        this.paint( g );                
        g.popContext();
    }
    

    【讨论】:

      【解决方案2】:

      您可以为自定义字段覆盖 Field.drawFocus

      protected void drawFocus(Graphics g, boolean on) {
          // Custom focus painting
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-06-13
        • 1970-01-01
        • 2016-06-08
        • 1970-01-01
        • 1970-01-01
        • 2014-07-20
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多