10-19-2011 02:33 AM
Hii,
I have created one sample application using tableLayOut Manager .i have added 5 images in array,but i am getting only first 2 images .and also i am not able to scroll it Horizontally .Hear is my code snippet.
public class TableDemo extends MainScreen {
Bitmap[] bit = new Bitmap[5];
int _columns;
public static final int USE_PREFERRED_SIZE = 3;
public TableDemo(){
bit[0] = Bitmap.getBitmapResource("1.jpg");
bit[1] = Bitmap.getBitmapResource("2.jpg");
bit[2] = Bitmap.getBitmapResource("3.jpg");
bit[3] = Bitmap.getBitmapResource("4.jpg");
bit[4] = Bitmap.getBitmapResource("5.jpg");
TableLayoutManager colFMgr = new TableLayoutManager(new int[]
{
TableLayoutManager.USE_PREFERRED_SIZE,
TableLayoutManager.USE_PREFERRED_SIZE,
TableLayoutManager.USE_PREFERRED_SIZE,
TableLayoutManager.USE_PREFERRED_SIZE,
TableLayoutManager.USE_PREFERRED_SIZE
}, Field.FIELD_HCENTER|HORIZONTAL_SCROLL|HORIZONTAL_S CROLLBAR);
for(int i= 0;i < bit.length;i++)
{
colFMgr.add(new BitmapField(bit[i], Field.FOCUSABLE));
}
add(colFMgr);
}
}need your Suggetions.
thanks.
10-19-2011 06:12 AM
I'm not sure
USE_PREFERRED_SIZE
is the right thing to use, try
SPLIT_REMAINING_WIDTH
You might have to scale the Bitmaps to match the screen size you are using.
10-19-2011 07:42 AM
10-19-2011 09:04 AM
10-19-2011 09:40 AM
Try adding USE_ALL_WIDTH to the style for the Manager.
10-19-2011 09:57 AM
10-19-2011 10:14 AM
I would recommend in fact that you review the TableLayoutManager code. It is not too bad and a good example of a layout manager. So have a look at it, perhaps even debug the sublayout method. That method might be, because of your Manager structure, being called with a width set to the screen width. And that would explain the problem you are having. Anyway, have a play!