我正在使用 TableLayoutManager,正如您从下面的代码中看到的那样现在的问题是我无法专注于细节按钮,我只能专注于呼叫按钮,如果我使用的是 Blackberry 9650 模拟器,那么我可以触摸按钮,但它真的很奇怪,我无法专注于按钮,请帮帮我
private void addDetailListing(){
VerticalFieldManager mainManager=new VerticalFieldManager(Manager.USE_ALL_WIDTH);
HorizontalFieldManager header=new HorizontalFieldManager(Manager.USE_ALL_WIDTH);
BitmapField headerField=new BitmapField(Bitmap.getBitmapResource("bb_images.png"));
header.add(headerField);
mainManager.add(header);
TableLayoutManager outerTable=new TableLayoutManager(new int[]{
TableLayoutManager.USE_PREFERRED_SIZE},TableLayoutManager.USE_ALL_WIDTH);
for(int a=0;a<2;a++){
TableLayoutManager innerTable = new TableLayoutManager(new int[]{
TableLayoutManager.USE_PREFERRED_SIZE,
TableLayoutManager.USE_PREFERRED_SIZE,
TableLayoutManager.USE_PREFERRED_SIZE
}, TableLayoutManager.USE_ALL_WIDTH) {
// overriding the paint method
public void paint(Graphics graphics){
Bitmap bgBitmap=Bitmap.getBitmapResource("bd_gray.png");
graphics.drawBitmap(0, 0, bgBitmap.getWidth(),bgBitmap.getHeight(), bgBitmap,0,0);
super.paint(graphics);
}// end og the paint ,methos
};
innerTable.setPadding(01, 0, 01, 0);
LabelField companyTitleField=new LabelField(" IT SOLUTION"){
public void paint(Graphics graphics){
graphics.setColor(Color.WHITE);
super.paint(graphics);
}
};
LabelField viewDetailButton=new LabelField("View Detail");
//viewDetailButton.setFont(new Font());
LabelField featuresField=new LabelField("Featured"){
public void paint(Graphics graphics){
graphics.setColor(Color.WHITE);
super.paint(graphics);
}
};
FontFamily fontFamily[] = FontFamily.getFontFamilies();
Font font = fontFamily[1].getFont(FontFamily.CBTF_FONT, 15);
viewDetailButton.setFont(font);
final Bitmap callBitmap=Bitmap.getBitmapResource("call_image.png");
//BitmapField contactButton=new BitmapField(callBitmap,Field.FOCUSABLE);
HorizontalFieldManager callAddManager=new HorizontalFieldManager(Manager.USE_ALL_WIDTH);
BitmapButtonField contactButton=new BitmapButtonField(callBitmap,callBitmap);
contactButton.setChangeListener(this);
contactButton.setLabel("Call");
contactButton.setFont(font);
//contactButton.layout(50, 30);
/*
final Bitmap contactBitmap=Bitmap.getBitmapResource("add_contact.png");
BitmapField addContact=new BitmapField(contactBitmap,Field.FOCUSABLE){
protected void layout(int width, int height) {
setExtent(contactBitmap.getWidth()+10, contactBitmap.getHeight()+10);
} };
*/
final Bitmap contactBitmap=Bitmap.getBitmapResource("add_contact.png");
/*
BitmapField addContact=new BitmapField(contactBitmap,Field.FOCUSABLE){
protected void layout(int width, int height) {
setExtent(contactBitmap.getWidth()+10, contactBitmap.getHeight()+10);
}
};
*/
BitmapButtonField addContactField=new BitmapButtonField(contactBitmap,contactBitmap);
addContactField.setFont(font);
innerTable.add(companyTitleField);
innerTable.add(new LabelField());
innerTable.add(viewDetailButton);
innerTable.add(featuresField);
callAddManager.add(contactButton);
callAddManager.add(addContactField);
innerTable.add(callAddManager);
outerTable.add(innerTable);
}
mainManager.add(outerTable);
add(mainManager);
}// end of the addDetailListing