首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2ME开发 >

9宫格高亮显示,UI界面有关问题,请高手指教!炮炮快来

2012-02-11 
9宫格高亮显示,UI界面问题,请高手指教!~炮炮快来NOKIA的9宫格模式怎么实现?思路是什么?选者后高亮?我自己

9宫格高亮显示,UI界面问题,请高手指教!~炮炮快来
NOKIA的9宫格模式怎么实现?思路是什么?选者后高亮?

我自己是用自定义类做
但老是往下排列,不能行排,是不是跟布局设置有关?

  public   static   class   xx   extends   CustomItem
                {
         
                private   static   final   int   INDENT_MARGIN   =   8;


                private   int   indent;

                private   String   text;

                private   Image   img;  


                private   static   OutlineItem   traversingItem;
                //构造函数
                public   OutlineItem(   int   inIndent,   String   inText   )
                {
                     
                        super(   null   );
                       
                        indent   =   inIndent;
                        text   =   inText;
                        try{
                                img=Image.createImage( "/read.png ");
                                }catch(Exception   e){}
                               


                         
                        setLayout(   LAYOUT_2   |   LAYOUT_LEFT   |   LAYOUT_TOP   |
                                LAYOUT_EXPAND   |   LAYOUT_NEWLINE_AFTER   );//???上这里布局的问题吗?

             
                }

 
               
                public   int   getMinContentHeight()
                {
                        return   FONT_HEIGHT;
                }

                public   int   getMinContentWidth()
                {
                        return   indent   *   INDENT_MARGIN   +   FONT_HEIGHT;
                        //   we   might   not   have   text   to   calculate   font   width


                }

                public   int   getPrefContentWidth(   int   height   )
                {
                        return   indent   *   INDENT_MARGIN  
                                +   FONT.stringWidth(   text   )   +   FONT_HEIGHT;
                }

                public   int   getPrefContentHeight(   int   width   )
                {
                        return   FONT_HEIGHT;
                }
             
                public   void   paint(   Graphics   g,   int   w,   int   h   )
                {
                        g.setColor(   DISPLAY.getColor(   DISPLAY.COLOR_BACKGROUND   )   );
                        g.fillRect(   0,   0,   w,   h   );
                       
                        g.setColor(   DISPLAY.getColor(   DISPLAY.COLOR_FOREGROUND   )   );
                                                                       
                        g.drawImage(img,0,indent,   g.TOP   |   g.LEFT   );

                }
        }

[解决办法]
啊!?sorry,可能我没有说清楚,我的意思是用canvas来做...呵呵,所以大家不要见笑啦

热点排行