2013-01-25 32 views
1

這裏是我的代碼:形式不能滾動時包含列表LWUIT

public Form getMenuForm() 
{ 
    if (menuForm == null) 
    { 
     Form menuForm = new Form("Tracking Main Menu"); 
     menuForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); 
     menuForm.setScrollable(true); 
     menuForm.setScrollableY(true); 
     menuForm.addComponent(this.getMenuList()); 
     for(int i=0;i<30;i++) 
     { 
      Label lblTest = new Label("hello guys"); 
      menuForm.addComponent(lblTest); 
     } 
     menuForm.addCommand(new Command("Exit")); 
     menuForm.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, true, 
      200)); 
     menuForm.addCommandListener(this); 
    } 
    return menuForm; 
} 

public List getMenuList() 
{ 
    String[] menuItems = { "Find Person", "Person Registration", "Message", "Setting" }; 
    if (menuList == null) 
    { 
     menuList = new List(menuItems); 
     menuList.setListCellRenderer(new DefaultListCellRenderer(false)); 
     menuList.setSmoothScrolling(true); 
     menuList.setFixedSelection(List.FIXED_NONE); 
     menuList.addActionListener(this); 
    } 
    return menuList; 
} 

我只能選擇列表中的4個選項,我不能向下滾動查看屏幕的底部。難道我錯過這裏的東西,請大家幫我...

回答

0

也許你需要這樣做:

menuList.setScroable(true); 
+0

我已經做到了:) – user2010313

2

您需要設置menuForm可滾動假,讓列表的滾動性接管。您將可滾動內容嵌套在另一個內,導致糟糕的用戶體驗。

+0

感謝Shai Almog,我重置了你的嚮導,但仍然無法向下滾動到底部... – user2010313

+0

我們在Codename One中做了一些修復,我不知道如何儘管如此,在LWUIT上幫助你。 –