开发者

here labels r getting added but not in correct alignment.check the code and guide me the correct way?

subManager = new VerticalFieldManager()
{
    protected void sublayout( int maxWidth, int maxHeight )
    {
        int displayWidth = 开发者_C百科300;
        int displayHeight = 200;

        super.sublayout( displayWidth, displayHeight);
        setExtent( displayWidth, displayHeight);                
    }
};
subManager.setBackground(BackgroundFactory.createSolidTransparentBackground(9800909,200));

/// add your component to this subManager/////////      

subManager.add(new LabelField("NeelInfo", FIELD_TOP));
subManager.add(new LabelField("Email id", FIELD_HCENTER));
subManager.add(new LabelField("Phone No", FIELD_BOTTOM));


//add subManager over the mainManager
mainManager.add(subManager);
mainManager.add(subManager1);


you can use the absolute field manager in such contexts

In AbsoluteFieldManager you can add the fields at specified coordinates such as

afm is the object of AbsoluteFieldManager afm.add(YourFieldObj,xCoord,yCoord); add(afm) .. adding it to the screen

you can write your code this way:

class ClassName extends MainScreen
{
     AbsoluteFieldManager afm;
     public ClassName()
     {
          \\your code
          afm = new AbsoluteFieldManager()
          {
                 public void paint(Graphics g)
                 {
                   \\this will draw the background with the image for u    
                    g.drawpaint \\method which needs a bitmap
                 }
          };
          add(afm);
          afm.add(FieldObj,xCoord,yCoord);
     }
}

I hope this will help you :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜