Hi i want to Add Multiple Images on the Horizontal Scroll Field Manager.
Staring Point of the Horizontal Field Manager is Middle of the Screen Horizontally.
Position of Focus image (y coordinate) up form another images.
When Focus Changed from image to right than scroll images Right Side.
If Focus Changed from images to left than scroll images left up to full Width of the Screen Left.
But the Starting Point of Images Middle of the Screen Horizontally.
Here is My Code for that
public class MainClass extends MainScreen{
private HorizontalFieldManager hManager;
private HorizontalFieldManager[] hBitmap;
int Height = Display.getHeight();
int Width = Display.getWidth();
private PictureScrollField pictureScrollField;
private String footer_images[] = new String[]
{"ajtak.jpg","assiant.jpg","astha.jpg","fox_news.jpg",
"cnbc.jpg","india_news.jpg","zee.jpg"};
private Bitmap [] bitmaps;
private ScrollEntry[] entries;
public MainClass()
{
hManager = new HorizontalFieldManager()
{
protected void sublayout(int maxWidth,int maxHeight)
{
super.sublayout(maxWidth, maxHeight);
setExtent(Width, 60);
}
};
bitmaps = new Bitmap[footer_images.length];
entries = new ScrollEntry[footer_images.length];
for(int i =0; i < footer_images.length;i++)
{
bitmaps[i] = Bitmap.getBitmapResource(footer_images[i]);
entries[i] = new ScrollEntry(bitmaps[i], "", "");
}
pictureScrollField = new PictureScrollField(36, 36);
pictureScrollField.setData(entries, 0);
pictureScrollField.setImageDistance(38);
pictureScrollField
.setHighlightStyle(HighlightStyle.ILLUMINATE);
pictureScrollField.setHighlightBorderColor(Color.GREEN);
pictureScrollField.setBackground(BackgroundFactory
.createSolidTransparentBackground(0x212424, 150));
pictureScrollField.setLabelsVisible(false);
pictureScrollField.setFocusListener(new FocusChangeListener() {
public void focusChanged(Field field, int eventType) {
if (pictureScrollField.isFocus()) {
switch (pictureScrollField.getCurrentImageIndex()) {
case 0:
setMargin(0, 0, 20, 0);
break;
case 1:
setMargin(0, 0, 20, 0);
break;
case 2:
setMargin(0, 0, 20, 0);
break;
case 3:
setMargin(0, 0, 20, 0);
break;
case 4:
setMargin(0, 0, 20, 0);
break;
case 5:
setMargin(0, 0, 20, 0);
break;
default:
break;
}
}
}
});
hManager.add(pictureScrollField);
add(hManager);
}
Try this