我将如何在黑莓中制作此类列表?

发布于 2025-01-06 07:22:41 字数 189 浏览 3 评论 0原文

我想做这种类型的定制列表。

在此处输入图像描述

我有那个红色图像&我必须在该红色图像上匹配当前月份接下来的 5 个日期在那附近我想添加四个文本。我随身带着该列表的白色背景图片。 如何在黑莓上做到这一点。请帮助我......

I want to make this type of customized list .

enter image description here

I have that red color image & i have to fit coming next 5 date n current month on that red image & near to that i want to add four text. I have that white background image of that list with me .
how to do it in blackberry.Please help me ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

柠檬色的秋千 2025-01-13 07:22:41

You can use "Create a Custom Listfield - Change Highlight Color when Scrolling" from the berrytutorials blog to learn how to create a listField . In the drawListRow method you can get the graphics object and draw the list row as you want.

Use graphics.drawText() to draw text , graphics.drawBitmap() to draw images etc.

≈。彩虹 2025-01-13 07:22:41
This was my requirement Hence I did not go for the listField option...
Try it may be helpful..

listVFM = new VerticalFieldManager();

rowHFM = new HorizontalFieldManager[10];

imageBitmapField = new BitmapField[10];

img_bitmap = Bitmap.getBitmapResource("image.png");

descriptionLabel = new LabelField[10];

discountLabel = new LabelField[10];

goButton = new RoundedCustomButtonField[10];

goSelectBitmap = Bitmap.getBitmapResource("btnSelectGo.png");

goUnselectBitmap = Bitmap.getBitmapResource("btnUnselectGo.png");


row_height = 90;

int j=0;

int row_count = 0;

for(int i=0; i<10; i++) {

    rowHFM[row_count] = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_HEIGHT) {

        protected void sublayout(int maxWidth, int maxHeight) {

            int displayWidth = Display.getWidth();
            int displayHeight = 80;

            super.sublayout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }

    };


    rowHFM[row_count].setPadding(2, 2, 2, 2);

    imageBitmapField[row_count] = new BitmapField(img_bitmap, BitmapField.FIELD_VCENTER | BitmapField.VCENTER |                     BitmapField.USE_ALL_HEIGHT) {

        protected void layout(int maxWidth, int maxHeight)
        {
            int displayWidth = 85;
            int displayHeight = 70;

            super.layout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }   
    };

    imageBitmapField[row_count].setPadding(0,0,0,4);


    descriptionLabel[row_count] = new LabelField("Description.....") {

        protected void layout(int maxWidth, int maxHeight) {

            int displayWidth = (int)(Display.getWidth()/2.6);
            int displayHeight = maxHeight;

            super.layout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }   

    };


    descriptionLabel[row_count].setPadding(5,0,0,2);

    discountLabel[row_count] = new LabelField(discountRate + "%") {

        protected void layout(int maxWidth, int maxHeight) {

            int displayWidth = (int)(Display.getWidth()/4.8);
            int displayHeight = maxHeight;

            super.layout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }   

    };


    discountLabel[row_count].setPadding(5,0,0,2);

    goButton[row_count] = new CustomButtonField("go",goSelectBitmap ,goUnselectBitmap, Field.FIELD_VCENTER              |Field.USE_ALL_HEIGHT);



    goButton[row_count].setPadding(0,0,0,2);

    goButton[row_count].setChangeListener(new FieldChangeListener() {

        public void fieldChanged(Field field, int context) {

            //code....
        }

    });

    rowHFM[row_count].add(imageBitmapField[row_count]);

    rowHFM[row_count].add(descriptionLabel[row_count]);

    rowHFM[row_count].add(discountLabel[row_count]);

    rowHFM[row_count].add(goButton[row_count]);

    listVFM.add(rowHFM[row_count]);

    row_count++;

}
This was my requirement Hence I did not go for the listField option...
Try it may be helpful..

listVFM = new VerticalFieldManager();

rowHFM = new HorizontalFieldManager[10];

imageBitmapField = new BitmapField[10];

img_bitmap = Bitmap.getBitmapResource("image.png");

descriptionLabel = new LabelField[10];

discountLabel = new LabelField[10];

goButton = new RoundedCustomButtonField[10];

goSelectBitmap = Bitmap.getBitmapResource("btnSelectGo.png");

goUnselectBitmap = Bitmap.getBitmapResource("btnUnselectGo.png");


row_height = 90;

int j=0;

int row_count = 0;

for(int i=0; i<10; i++) {

    rowHFM[row_count] = new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_HEIGHT) {

        protected void sublayout(int maxWidth, int maxHeight) {

            int displayWidth = Display.getWidth();
            int displayHeight = 80;

            super.sublayout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }

    };


    rowHFM[row_count].setPadding(2, 2, 2, 2);

    imageBitmapField[row_count] = new BitmapField(img_bitmap, BitmapField.FIELD_VCENTER | BitmapField.VCENTER |                     BitmapField.USE_ALL_HEIGHT) {

        protected void layout(int maxWidth, int maxHeight)
        {
            int displayWidth = 85;
            int displayHeight = 70;

            super.layout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }   
    };

    imageBitmapField[row_count].setPadding(0,0,0,4);


    descriptionLabel[row_count] = new LabelField("Description.....") {

        protected void layout(int maxWidth, int maxHeight) {

            int displayWidth = (int)(Display.getWidth()/2.6);
            int displayHeight = maxHeight;

            super.layout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }   

    };


    descriptionLabel[row_count].setPadding(5,0,0,2);

    discountLabel[row_count] = new LabelField(discountRate + "%") {

        protected void layout(int maxWidth, int maxHeight) {

            int displayWidth = (int)(Display.getWidth()/4.8);
            int displayHeight = maxHeight;

            super.layout( displayWidth, displayHeight);
            setExtent( displayWidth, displayHeight);
        }   

    };


    discountLabel[row_count].setPadding(5,0,0,2);

    goButton[row_count] = new CustomButtonField("go",goSelectBitmap ,goUnselectBitmap, Field.FIELD_VCENTER              |Field.USE_ALL_HEIGHT);



    goButton[row_count].setPadding(0,0,0,2);

    goButton[row_count].setChangeListener(new FieldChangeListener() {

        public void fieldChanged(Field field, int context) {

            //code....
        }

    });

    rowHFM[row_count].add(imageBitmapField[row_count]);

    rowHFM[row_count].add(descriptionLabel[row_count]);

    rowHFM[row_count].add(discountLabel[row_count]);

    rowHFM[row_count].add(goButton[row_count]);

    listVFM.add(rowHFM[row_count]);

    row_count++;

}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文