2

正如您从 SSCCE 中看到的那样,我执行了 setBanner() 和 setStatus(),然后只在两者之间添加了一个 EditField。

现在在 Torch 上,如果您在 EditField 中输入大量字符,直到其高度超过横幅和状态之间的区域,最后文本行将与状态栏重叠。看截图:在此处输入图像描述

这只发生在我为 EditField 设置边距时,但显然我需要这个边距。似乎是一个 Torch 错误,因为它适用于其他 BB 设备。但是有人可能知道解决方法吗?

这是SSCCE:

import net.rim.device.api.browser.field2.BrowserField;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.decor.BackgroundFactory;

public class CutOff extends UiApplication implements Runnable
{
    /**
     * @param args
     */
    public static void main(final String[] args)
    {
        final CutOff bt = new CutOff();
        bt.invokeLater(bt);
        bt.enterEventDispatcher();

    }

    public void run()
    {
        final MainScreen s = new MainScreen();
        //header
        final HorizontalFieldManager head = new HorizontalFieldManager();
        head.add(new ButtonField("header"));
        s.setBanner(head);

        //footer
        final HorizontalFieldManager hf = new HorizontalFieldManager();
        hf.setBackground(BackgroundFactory.createSolidBackground(Color.RED));
        hf.add(new ButtonField("test"));
        final EditField f = new EditField();
        f.setMargin(10, 10, 10, 10);
        s.add(f);
        s.setStatus(hf);

        UiApplication.getUiApplication().pushScreen(s);
    }

}

谢谢

4

1 回答 1

2

尝试这个 -

将您的 EditField 添加到 Horizo​​ntalFieldManager。

     final MainScreen s = new MainScreen();
    //header
    final HorizontalFieldManager head = new HorizontalFieldManager();
    head.add(new ButtonField("header"));
    s.setBanner(head);

    //footer
    final HorizontalFieldManager hf = new HorizontalFieldManager();
    hf.setBackground(BackgroundFactory.createSolidBackground(Color.RED));
    hf.add(new ButtonField("test"));
    HorizontalFieldManager h=new HorizontalFieldManager(HorizontalFieldManager.VERTICAL_SCROLL);
    final EditField f = new EditField();
    f.setMargin(10, 10, 10, 10);
    h.add(f);
    s.add(h);
    s.setStatus(hf);

    UiApplication.getUiApplication().pushScreen(s);
于 2013-04-08T10:11:46.580 回答