如何在Blackberry中创建一个简单的网格视图? [英] How to create a simple grid view in Blackberry?

查看:78
本文介绍了如何在Blackberry中创建一个简单的网格视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Blackberry中添加网格视图,请帮我解决这个问题

Is there any way to add grid view in blackberry, plz help me for this

推荐答案

下面的代码可以帮助您创建网格视图:-

Below code helps you to create grid view :-

public final class gridFieldDemoScreen extends MainScreen
{
	LabelField one, two, three, four, five, six;
	public gridFieldDemoScreen()
    {
        setTitle("gridFieldDemo");   
        GridFieldManager grid = new GridFieldManager(2, 3, 0); // add number of rows and columns you want in ur grid i.e in this i take row = 2 and column = 3
        one = new LabelField("ONE");
        grid.insert(one, 0);  // this statement will add text to the grid and 0 is for position means index position of a text
        two = new LabelField("TWO");
        grid.insert(two , 1);
        three = new LabelField("THREE");
        grid.insert(three, 2);
        four = new LabelField("FOUR");
        grid.insert(four, 3);
        five = new LabelField("FIVE");
        grid.insert(five, 4);
        six = new LabelField("SIX");
        grid.insert(six, 5);
        grid.setColumnPadding(20); // this will use for gap between one grid element to other
        grid.setRowPadding(20);
        add(grid); // this will add grid to the screen
    }
}


这篇关于如何在Blackberry中创建一个简单的网格视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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