带有不可编辑文本的可滚动字段

发布于 2024-12-19 23:30:28 字数 784 浏览 1 评论 0原文

在我的应用程序中,我需要一个可滚动字段,其中包含具有自定义大小的不可编辑文本。我正在尝试这样做:

final int sx2 = Display.getWidth()-Display.getWidth()*2/51-kButtonWidgh;
final int sy2 = Display.getHeight()*7/12;
VerticalFieldManager vfm3 = new VerticalFieldManager()
        {

         public void sublayout( int maxWidth, int maxHeight )
         {
             super.sublayout(sx2, sy2);
         }
        };
        text = new TextField((Field.FOCUSABLE & Field.READONLY & Field.STATUS_MOVE_FOCUS_HORIZONTALLY)){
            public void layout( int maxWidth, int maxHeight ) {
                super.layout(sx2, sy2);   //my custom frame
                }
            };
        vfm3.add(text);
        vfm2.add(vfm3);

但它是可编辑的,并且不可滚动。文本从起始字段开始打印,并在远离框架的地方结束。光标超出了场框,并且没有滚动。我该怎么做?

In my app I need a scrollable field with non-editable text with custom size. I'm trying to do this like below:

final int sx2 = Display.getWidth()-Display.getWidth()*2/51-kButtonWidgh;
final int sy2 = Display.getHeight()*7/12;
VerticalFieldManager vfm3 = new VerticalFieldManager()
        {

         public void sublayout( int maxWidth, int maxHeight )
         {
             super.sublayout(sx2, sy2);
         }
        };
        text = new TextField((Field.FOCUSABLE & Field.READONLY & Field.STATUS_MOVE_FOCUS_HORIZONTALLY)){
            public void layout( int maxWidth, int maxHeight ) {
                super.layout(sx2, sy2);   //my custom frame
                }
            };
        vfm3.add(text);
        vfm2.add(vfm3);

But it editable, and not scrollable. Text prints from beginning field and ends far away from it's frame. there is cursor, which goes out of field frame, and there is no scrolling. How should I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜清冷一曲。 2024-12-26 23:30:29

试试这个:

EditField _text = new EditField(Field.HORIZONTAL_SCROLL|Field.VERTICAL_SCROLL);
_text.setEditable(false);

try this:

EditField _text = new EditField(Field.HORIZONTAL_SCROLL|Field.VERTICAL_SCROLL);
_text.setEditable(false);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文