转自: http://doll.iteye.com/blog/588502
- import net.rim.device.api.ui.Color;
- import net.rim.device.api.ui.Graphics;
- import net.rim.device.api.ui.Manager;
- import net.rim.device.api.ui.container.FlowFieldManager;
- import net.rim.device.api.ui.container.PopupScreen;
- public class PopupView extends PopupScreen {
- public PopupView() {
- super(new FlowFieldManager(Manager.FIELD_HCENTER));
- }
- protected void paint(Graphics g) {
- g.setColor(Color.RED);
- g.drawText("Just do it", 0, 0);
- }
- public void _drawAlpha(int _x, int _y, int _width, int _height, int _color,
- Graphics g) {
- int _array[] = new int[_width * _height];
- for (int i = 0; i < _array.length; i++) {
- _array[i] = _color;
- }
- g.drawARGB(_array, 0, _width, _x, _y, _width, _height);
- }
- protected void paintBackground(Graphics graphics) {
- // super.paintBackground(graphics);
- _drawAlpha(0, 0, this.getWidth(), this.getHeight(), 0X66223311,
- graphics);
- }
- protected void sublayout(int width, int height) {
- // super.sublayout(width, height);
- this.setPosition(0, 12);
- this.setExtent(130, 30);
- }
- }
本文介绍了一个 BlackBerry 平台上定制化的弹窗组件实现方式。该组件使用 FlowFieldManager 布局,并通过 Graphics API 绘制背景及文本内容。文章展示了如何设置弹窗的位置、大小,并使用自定义颜色绘制透明背景。
2949

被折叠的 条评论
为什么被折叠?



