1

我是黑莓新手,我正在开发一个黑莓应用程序,我在其中制作了一个登录屏幕,其中一个白色条形图像放置在顶部,并且徽标应该出现在该条上。所以很简单,我为它取了两个 Horizo​​ntalFieldManager,对于 strip,它会显示得很好,但 logo 留在 strip 的下方。

这是我的代码::

((VerticalFieldManager) getMainManager()).setBackground(BackgroundFactory.createSolidBackground(0xEDEDED));

        HorizontalFieldManager hfm =  new HorizontalFieldManager(Field.FIELD_VCENTER );
        HorizontalFieldManager hfm2 =  new HorizontalFieldManager(Field.FIELD_VCENTER );
        Bitmap Topstrip = new Bitmap(Display.getWidth(), Display.getHeight());
        Bitmap MoneLogo = new Bitmap(Display.getWidth(), Display.getHeight());
        boolean lowRes = Display.getWidth() <= 320;
        if (lowRes)
        {
            // The device has a low resolution screen size
            Topstrip = Bitmap.getBitmapResource("topstripbg.png");
        }
        else
        {
            Topstrip = Bitmap.getBitmapResource("topstripbg-mdpi.png");
            MoneLogo= Bitmap.getBitmapResource("logo72X72.png");
            // The device has a high resolution screen size

        }
        BitmapField TopstripimgField = new BitmapField(Topstrip);
        BitmapField MoneLogoimgField = new BitmapField(MoneLogo);

        hfm.add(TopstripimgField);
        hfm2.add(MoneLogoimgField);
        add(hfm);
        add(hfm2);

我想要这样::

--------------------------------------
 ____
|LOGO|           ** Strip ** 
|____|
--------------------------------------

还请向我推荐好的 UI 教程以获得最佳实践

更新:

在此处输入图像描述

4

1 回答 1

2

尝试这个 -

final Bitmap bg=Bitmap.getBitmapResource("background.png");
    VerticalFieldManager top = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){
        public void paint(Graphics graphics) {
            graphics.setBackgroundColor(Color.WHITE);
            graphics.clear();
            graphics.drawBitmap(0, 0, bg.getWidth(),
                    bg.getHeight(), bg, 0, 0);
            super.paint(graphics);
        }

    };


final Bitmap logo= Bitmap.getBitmapResource("logo.png");
top .add(new BitmapField(logo));
add(top);
于 2012-07-27T07:19:25.540 回答