2012-04-21 22 views
0

enter image description here水平なマネージャでイベントを表示しようとしていますが、複数のイベントが表示されています。今は10イベントが表示されています。残りの10個のイベントがあります。以下のスニペットを使用して1つの行に1つのイベントを表示できます。下のスニペットを編集して1つの行に2つのイベントを取得する方法はここでイベントはlabelfieldに追加されます。水平マネージャを分割する方法

VerticalFieldManager vfm = new VerticalFieldManager(); 
     int allDayVectorSize = allDayVector.size(); 
     horizontalFieldManager_isAllDay = new HorizontalFieldManager[allDayVectorSize]; 
     allDayLabel = new LabelField[allDayVectorSize]; 
     row_height = 90; 
     int j = 0; 
     int row_count = 0; 

     if (allDayVectorSize != 0) { 
      for (int i = 0; i < allDayVectorSize; i++) { 
       final String allEvent = (String) allDayVector.elementAt(i); 
       horizontalFieldManager_isAllDay[row_count] = new HorizontalFieldManager(
         Manager.FOCUSABLE | Manager.HORIZONTAL_SCROLL) { 

        protected boolean navigationClick(int status, int time) { 
         Field field = getFieldWithFocus(); 

         Vector data = getData(listEvent); 

         if (allEvent != null && allEvent != "") { 
          System.out.println("Currentdata in if" + allEvent); 
          UiApplication.getUiApplication().pushScreen(
            new EventScreen(data, allEvent, "")); 
         } 
         return super.navigationClick(status, time); 
        } 

        protected boolean keyChar(char key, int status, int time) { 
         Field field = getFieldWithFocus(); 

         return super.keyChar(key, status, time); 
        } 

        protected void sublayout(int maxWidth, int maxHeight) { 
         int displayWidth = Display.getWidth(); 
         int displayHeight = 30; 
         super.sublayout(displayWidth, displayHeight); 
         setExtent(displayWidth, displayHeight); 
        } 
       }; 
       horizontalFieldManager_isAllDay[row_count].setPadding(2, 2, 2, 
         2); 
       allDayLabel[row_count] = new LabelField(allEvent, 
         LabelField.FOCUSABLE) { 

        protected void layout(int maxWidth, int maxHeight) { 

         int displayWidth = (int) (Display.getWidth()/2); 
         int displayHeight = maxHeight; 

         super.layout(displayWidth, displayHeight); 
         setExtent(displayWidth, displayHeight); 
        } 

       }; 

       // allDayLabel[row_count].setPadding(5, 0, 0, 2); 
       final ImageButtonField alarmBitmapField2 = new ImageButtonField(
         "", Field.FOCUSABLE, "ringtone.png", "ringtone.png", 
         0x9cbe95); 
       horizontalFieldManager_isAllDay[row_count] 
         .add(alarmBitmapField2); 
       horizontalFieldManager_isAllDay[row_count] 
         .add(allDayLabel[row_count]); 
       vfm.add(horizontalFieldManager_isAllDay[row_count]); 
       vfm.add(new SeparatorField()); 
      } 
     } 
+0

あなたはスクリーンショットを提供することができますか? – alishaik786

+0

私のuiはイベントがリストされているネイティブカレンダーuiと同じです。私はただ1つの行に2つのラベルを表示したいのですが、10のラベルがある場合は5行を作成する必要があります@ alishaik786 –

+0

レイアウトのスクリーンショットまたはスケッチ欲しいです。 – Rupak

答えて

0
VerticalFieldManager vfm = new VerticalFieldManager(); 
     int allDayVectorSize = allDayVector.size(); 
     int hfmSize=(allDayVectorSize %2 ==0)allDayVectorSize/2:allDayVectorSize +1; 
     horizontalFieldManager_isAllDay = new HorizontalFieldManager[hfmSize]; 
     allDayLabel = new LabelField[allDayVectorSize]; 
     row_height = 90; 
     int j = 0; 

     if (allDayVectorSize != 0) { 
      for (int i = 0; i < hfmSize; i++) { 

       horizontalFieldManager_isAllDay[i] = new HorizontalFieldManager(
         Manager.FOCUSABLE | Manager.HORIZONTAL_SCROLL|Manager.USE_ALL_WIDTH) { 

        protected boolean navigationClick(int status, int time) { 
         Field field = getFieldWithFocus(); 

         Vector data = getData(listEvent); 

         if (allEvent != null && allEvent != "") { 
          System.out.println("Currentdata in if" + allEvent); 
          UiApplication.getUiApplication().pushScreen(
            new EventScreen(data, allEvent, "")); 
         } 
         return super.navigationClick(status, time); 
        } 

        protected boolean keyChar(char key, int status, int time) { 
         Field field = getFieldWithFocus(); 

         return super.keyChar(key, status, time); 
        } 

        protected void sublayout(int maxWidth, int maxHeight) { 
         int displayWidth = Display.getWidth(); 
         int displayHeight = 30; 
         super.sublayout(displayWidth, displayHeight); 
         setExtent(displayWidth, displayHeight); 
        } 
       }; 
       horizontalFieldManager_isAllDay[i].setPadding(2, 2, 2, 
         2); 
       String allEvent = (String) allDayVector.elementAt(i*2); 
       allDayLabel[i*2] = new LabelField(allEvent, 
         LabelField.FOCUSABLE) { 

        protected void layout(int maxWidth, int maxHeight) { 

         int displayWidth = (int) (Display.getWidth()/2); 
         int displayHeight = maxHeight; 

         super.layout(displayWidth, displayHeight); 
         setExtent(displayWidth, displayHeight); 
        } 

       }; 



       // allDayLabel[row_count].setPadding(5, 0, 0, 2); 
       final ImageButtonField alarmBitmapField2 = new ImageButtonField(
         "", Field.FOCUSABLE, "ringtone.png", "ringtone.png", 
         0x9cbe95); 
       horizontalFieldManager_isAllDay[i] 
         .add(alarmBitmapField2); 
       horizontalFieldManager_isAllDay[i] 
         .add(allDayLabel[i*2]); 
       if(i*2+1<allDayVectorSize) 
       { 
         allEvent = (String) allDayVector.elementAt(i*2+1); 
         allDayLabel[i*2] = new LabelField(allEvent, 
         LabelField.FOCUSABLE) { 

           protected void layout(int maxWidth, int maxHeight) { 

            int displayWidth = (int) (Display.getWidth()/2); 
            int displayHeight = maxHeight; 

            super.layout(displayWidth, displayHeight); 
            setExtent(displayWidth, displayHeight); 
          } 

         }; 

         horizontalFieldManager_isAllDay[i] 
         .add(allDayLabel[i*2+1]); 
        } 
       vfm.add(horizontalFieldManager_isAllDay[row_count]); 
       vfm.add(new SeparatorField()); 
      } 
     } 
関連する問題