-1

我在创建后退按钮时遇到了一些问题。现在在表单中有列表,我需要在右下角的这个表单上创建按钮,当滚动列表时,按钮保持在它的位置(右下角)。我正在尝试在屏幕下方创建容器并使其隐形。但它没有帮助,因为列表没有出现在容器下。

4

2 回答 2

1

你可以试试这个...

import com.sun.lwuit.Command;
import com.sun.lwuit.Form;
import com.sun.lwuit.Display;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
public class FirstApp extends MIDlet implements ActionListener{

Form f;
Command exitCommand;
public FirstApp()
{
    //display form
   Display.init(this);
   f = new Form("myForm");
   f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}

public void commandAction(Command c, Displayable dis) 
{

}

protected void startApp() throws MIDletStateChangeException 
{   
   //add exit button
       Command exitCommand;
   exitCommand = new Command("EXIT")
   {
        public void actionPerformed(ActionEvent e) {
            notifyDestroyed();
       }
   };
  f.addCommand(exitCommand);
  f.setBackCommand(exitCommand);
}
于 2013-06-21T20:01:15.300 回答
0

您需要在对象命令中使用。

Command cmd = new Command(searchText) {
      public void actionPerformed(ActionEvent evt) {
           //TODO - implement back 
        }
    };

而不是将他添加到表单

f.addCommand(command);
于 2013-01-24T07:40:29.310 回答