Search bar on top of the mainscreen blackberry

五迷三道 提交于 2019-12-12 03:19:36

问题


I want to make one search bar on top of the mainscreen and this search bar should include one editfield and one image of search icon. Please help me...

Thanks, in advance


回答1:


You need to use an HorizontalFieldManager to put editfield and image on the same line. Read here http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/ui/container/HorizontalFieldManager.html and here: http://www.androidadb.com/class/ho/HorizontalFieldManager.html , a simple example showing how adding two buttons in an HorizontalFieldManager. Just substitute buttons with yor needed fields.

Or you can play with GridFieldMgr:

        GridFieldManager gridMgr_g = new GridFieldManager(1, 2, 0);
        gridMgr_g.setColumnProperty(0, GridFieldManager.FIXED_SIZE, screenWidth-myBitmapRes.width);
        gridMgr_g.setColumnProperty(1, GridFieldManager.FIXED_SIZE, myBitmapRes.width);

        gridMgr_g.add(new EditField());
        gridMgr_g.add(new BitmapField(Bitmap.getBitmapResource(myBitmapRes)));

        add(gridMgr_g);


来源:https://stackoverflow.com/questions/9872527/search-bar-on-top-of-the-mainscreen-blackberry

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!