2012-01-11 7 views
0

Im, создающий приложение, которое имеет слушателя при входящих вызовах, а затем добавляет поля на экран телефона. Однако я не могу точно контролировать ширину как labelields, так и используемого PhoneScreenVerticalManager. Если я пытаюсь установить границу или фон в PhoneScreenVerticalManager, ничего не происходит вообще. Похоже, что USE_ALL_WIDTH в конструкторе labelfield ничего не меняет. И получить labelields к левому выравниванию я также не мог работать (попробовал DrawStyle.Left в конструкторе labelfield).PhoneScreenVerticalManager weirdness при входящем вызове

вот мой код:

public Incoming(int callId) {  
    this.callId = callId; 
    PhoneCall call = Phone.getCall(callId); 
    String number = call.getPhoneNumber(); 
    Vector contact = ContactUtil.getContactByPhone(number); 
     screenModel = new ScreenModel(callId); 
     phoneScreenPortrait = screenModel.getPhoneScreen(PhoneScreen.PORTRAIT, PhoneScreen.INCOMING); 
     final XYRect rect = screenModel.getDimensions(PhoneScreen.PORTRAIT, PhoneScreen.INCOMING); 
PhoneScreenVerticalManager manager = new PhoneScreenVerticalManager() 
     { 

      public void paint(Graphics g) { 
       g.setColor(Color.BLACK); 
       g.setBackgroundColor(Color.WHITE); 
       g.clear(); 
       super.paint(g); 
      } 

      protected void sublayout(int width, int height) 
      { 
       super.sublayout(rect.width, height); 
       super.setExtent(rect.width, height); 
      } 

     };   

     manager.setBackground(BackgroundFactory.createSolidBackground(Color.RED)); 
     manager.setBorder(BorderFactory.createSimpleBorder(new XYEdges(BORDER_PADDING, BORDER_PADDING, BORDER_PADDING, BORDER_PADDING), Border.STYLE_SOLID)); 

     String s = res.getString(FOUND_IN_CONTACTS); 
     LabelField header = new LabelField(s, LabelField.USE_ALL_WIDTH) 
     { 
      protected void layout(int width, int height) 
      { 
       super.layout(rect.width, height); 
       setExtent(rect.width, height); 
      } 

      public void paint(Graphics g) { 
       g.setColor(Color.BLACK); 
       g.setBackgroundColor(Color.WHITE); 
       g.clear(); 
       super.paint(g); 
      } 
     }; 
     header.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); 
     manager.add(header); 
     LabelField label = new LabelField(contact.firstElement().toString(), LabelField.USE_ALL_WIDTH) 
     { 
      protected void layout(int width, int height) 
      { 
       super.layout(rect.width, height); 
       setExtent(rect.width, height); 
      } 

      public void paint(Graphics g) { 
       g.setColor(Color.BLACK); 
       g.setBackgroundColor(Color.WHITE); 
       g.clear(); 
       super.paint(g); 
      } 

     }; 
     label.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); 
     manager.add(label); 
     phoneScreenPortrait.add(manager); 
     screenModel.sendAllDataToScreen(); 
} 

Любые идеи, было бы весьма признателен ¨

Благодаря

ответ

1

хотя менеджеры phonescreen получены от менеджера поля он не поддерживает все свойства полевого менеджера.

Таким образом, решение состоит в том, чтобы настроить нормальный менеджер полей, а затем добавить их к менеджерам телефонов.

Смежные вопросы