文本字段的水平滚动 [英] TextField horizontal-scrolling

查看:150
本文介绍了文本字段的水平滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我已经实现水平通过这个环节<滚动文本href=\"http://stackoverflow.com/questions/2613062/how-can-i-display-scroll-text-like-marque-in-blackberry-using-j2me\">LabelField跑马灯。但我有一个问题,文本滚动相当不错,但它一直在这是added.Can人有任何想法如何从这个问题的应对原文过度写的?我也试图通过刷新视图无效()但是没有用的。我已经添加了我面临的问题的屏幕截图。

Hi i have implemented scrolling text horizontally through this link LabelField Marquee. But i have one problem,the text is scrolling quite good but its been over-written on the original text which was added.Can anyone have any idea how to cope from this problem? I also tried to refresh the view by invalidate() but of no use. i have added the screenshot of the problem which i am facing.

任何帮助将是AP preciable。

Any help would be appreciable.

感谢您。

推荐答案

我会建议你改变paint方法下一:

I would suggest you to change paint method to next:

 public void paint(Graphics graphics) {
    currentText = this.getText();
    if (currentChar < currentText.length()) {
        currentText = currentText.substring(currentChar);

    }
    graphics.drawText(currentText, 0, 0, DrawStyle.ELLIPSIS, 200);
}

所以不叫 super.paint()油漆

这篇关于文本字段的水平滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆