如果在Torch上设置了边距,则会切断EditField

时间:2013-04-08 08:45:59

标签: blackberry margin status banner blackberry-editfield

从SSCCE可以看出我执行setBanner()和setStatus(),然后只在其间添加一个EditField。

现在在Torch上,如果在EditField中输入大量字符,直到其高度超过横幅和状态之间的区域,则最后一个文本行将与状态栏重叠。请参见屏幕截图:enter image description here

这只会在我为EditField设置边距时发生,但显然我需要这个边距。似乎是一个火炬虫,因为它适用于其他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);
    }

}

由于

1 个答案:

答案 0 :(得分: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);