Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
ZevsVU
Posts: 20
Registered: ‎05-17-2012
My Device: have no device

Image disappear problem

Image disappear if i tried add two LabelField

In first version Image don't displaying

 

//---------------------------------------------------------

HorizontalFieldManager titleHFM2 = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER)
{
protected void sublayout(int maxWidth, int maxHeight)
{
setPositionChild(getField(0), maxWidth/2-getField(0).getPreferredWidth()/2, 0);
layoutChild(getField(0), getField(0).getPreferredWidth(),getField(0).getPreferredHeight());

setPositionChild(getField(1), 0, 0);
layoutChild(getField(1), getField(1).getPreferredWidth(),getField(1).getPreferredHeight());

setPositionChild(getField(2), 0, 50);
layoutChild(getField(2), getField(2).getPreferredWidth(),getField(2).getPreferredHeight());

setExtent(maxWidth,getField(0).getPreferredHeight()+100);
}
};
titleHFM2.add(bitmapWithImageName((number%2==0)?"f2_lower_bg":"f2_notification_backing"));

LabelField titleField = new LabelField(titleString);
titleHFM2.add(titleField);

LabelField contentText = new LabelField("123");
titleHFM2.add(contentText);
add(titleHFM2);
add(bitmapWithImageName("horizontal_rule"));

 

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

But after cut one LabelField image was displaying...

 

HorizontalFieldManager titleHFM2 = new HorizontalFieldManager(HorizontalFieldManager.FIELD_HCENTER)
{
protected void sublayout(int maxWidth, int maxHeight) 
{
setPositionChild(getField(0), maxWidth/2-getField(0).getPreferredWidth()/2, 0);
layoutChild(getField(0), getField(0).getPreferredWidth(),getField(0).getPreferredHeight());

setPositionChild(getField(1), 0, 0);
layoutChild(getField(1), getField(1).getPreferredWidth(),getField(1).getPreferredHeight());

setExtent(maxWidth,getField(0).getPreferredHeight()+100);
}
};
titleHFM2.add(bitmapWithImageName((number%2==0)?"f2_lower_bg":"f2_notification_backing"));

LabelField contentText = new LabelField("123");
titleHFM2.add(contentText);
add(titleHFM2);
add(bitmapWithImageName("horizontal_rule"));

 

could you help me please?

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: Image disappear problem

Can you debug the sublayout for your HFM, and tell us exactly the position and height and width for each of the Fields you are positioning.

 

So for your first case I am expecting you will tell us

 

Bitmap, x = ??, y == ???, width = ???, height = ???

First Label, x = ??, y == ???, width = ???, height = ???

Second label, x = ??, y == ???, width = ???, height = ??? 

 

Seocnd case:

 

Bitmap, x = ??, y == ???, width = ???, height = ???

Label, x = ??, y == ???, width = ???, height = ???

Contributor
ZevsVU
Posts: 20
Registered: ‎05-17-2012
My Device: have no device

Re: Image disappear problem

Thenk, i was aderstend your idea and fix my problem)