黑莓 - 单线BasicEditField有大量的文字 [英] Blackberry - single line BasicEditField with large text

查看:106
本文介绍了黑莓 - 单线BasicEditField有大量的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建使用Bitmap.Now而键入的文本边框定制BasicEditField,它跨越边境的 BasicEditField

I have created a customized BasicEditField with Border using Bitmap.Now while typing the text,it crosses the border of the BasicEditField.

这是我的code

class customEditField1 extends EditField
{
     Bitmap mBorder = null;
     customEditField1(Bitmap borderBitmap) 
     {
        mBorder = borderBitmap;
     }
     protected void paint(Graphics graphics) 
     {
         graphics.drawBitmap(0, 0, mBorder.getWidth(),mBorder.getHeight(), mBorder, 0, 0);
         super.paint(graphics);
     }
}

我想创建一个BasicEditField其中应该隐藏pviously输入的文本的$ P $,并显示新输入的文本和键入的文本应与在border.It不应取决于字符数limit.And我想申请文本和边框之间的填充。

I want to create a BasicEditField which should hide the previously entered text and displays the newly entered text and the typed text should be with in the border.It should not depends on the number of chars limit.And i want to Apply padding between the text and the border.

推荐答案

您可以把BasicEditField到Horizo​​ntalFieldManager。

不要忘了从BasicEditField移动边框位图绘画Horizo​​ntalFieldManager。

You can put BasicEditField into HorizontalFieldManager.
Don't forget to move border bitmap painting from BasicEditField to HorizontalFieldManager.

class ScrollEdit extends HorizontalFieldManager {
    Bitmap mBorder = null;
    public BasicEditField mEdit = null;

    public ScrollEdit(Bitmap border) {
    	super(HORIZONTAL_SCROLL | NO_HORIZONTAL_SCROLLBAR);
    	mBorder = border;
    	mEdit = new EditField(BasicEditField.NO_NEWLINE);
    	add(mEdit);
    }

    protected void paint(Graphics graphics) {
    	graphics.drawBitmap(0, 0, mBorder.getWidth(), mBorder.getHeight(),
    			mBorder, 0, 0);
    	super.paint(graphics);
    }

}

但是,你将不得不玩的布局和setExtent大小经理和正确地编辑。我的建议是首先尝试无边框的位图。

But you will have to play around with layout and setExtent to size manager and edit correctly. My advice is to try it without border bitmap first.

请参阅滚动BasicEditField代替保鲜膜

在谈到包裹,经理中设置填充,以BasicEditField或边境位图空白添加...

Talking about the wrap, set padding to BasicEditField within manager or add white space in border bitmap...

这篇关于黑莓 - 单线BasicEditField有大量的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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