BlackBerry:Reduce space between 2 buttons in HorizontalFieldManager
Posted
by
user469999
on Stack Overflow
See other posts from Stack Overflow
or by user469999
Published on 2010-12-22T03:30:39Z
Indexed on
2010/12/24
5:54 UTC
Read the original article
Hit count: 382
blackberry
|margins
hi In blackberry i have created a horizontal field managar and added some buttons of small size to it to display toolbar at the bottom of the screen.But my problem is there is too much space between the 2 buttons.I have to reduce this space between 2 buttons so that i can manage to place atleast 6 buttons at the bottom of the screen.I am using the BFmsg.setMargin(305,0,0,40) statement. can anyone please help me on this.
Following is my code :
BFcontacts = new ButtonField("Cnt")
{
protected void paint(Graphics graphics)
{
//Bitmap contactsbitmap = Bitmap.getBitmapResource("contacts.jpg");
//graphics.drawBitmap(0, 0, contactsbitmap.getWidth(), contactsbitmap.getHeight(), contactsbitmap, 0, 0);
graphics.setColor(Color.WHITE);
graphics.drawText("Cnt",0,0);
}
};
BFcontacts.setMargin(305,0,0,10);//vertical pos,0,0,horizontal pos
HFM.add(BFcontacts);
BFmsg = new ButtonField("Msgs")
{
protected void paint(Graphics graphics)
{
//Bitmap msgsbitmap = Bitmap.getBitmapResource("messages.jpg");
//graphics.drawBitmap(0, 0, msgsbitmap.getWidth(), msgsbitmap.getHeight(), msgsbitmap, 0, 0);
graphics.setColor(Color.WHITE);
graphics.drawText("Msgs",0,0);
}
};
BFmsg.setMargin(305,0,0,40);//vertical pos,0,0,horizontal pos : original
HFM.add(BFmsg);
add(HFM)
Thanks in advance
© Stack Overflow or respective owner