blackberry起步-图片滚动

1、图片滚动

package com.bb.test;

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.decor.BackgroundFactory;
import net.rim.device.api.ui.extension.component.PictureScrollField;
import net.rim.device.api.ui.extension.component.PictureScrollField.HighlightStyle;
import net.rim.device.api.ui.extension.component.PictureScrollField.ScrollEntry;

public class PictureScrollFieldDemoScreen  extends MainScreen{
	public PictureScrollFieldDemoScreen() {
		setTitle("PictureScrollField Demo");
		//图片
		Bitmap[] images = new Bitmap[3];
		images[0] = Bitmap.getBitmapResource("11.png");
		images[1] = Bitmap.getBitmapResource("22.png");
		images[2] = Bitmap.getBitmapResource("33.png");
		//图片标签
		String[] labels = new String[3];
		labels[0] = "Label for image 1";
		labels[1] = "Label for image 2";
		labels[2] = "Label for image 3"; 
		//文本标注
		String[] callout = new String[3];
		callout[0] = "information 11";
		callout[1] = "information 22";
		callout[2] = "information 33";

		//创建三个滚动条目 
		ScrollEntry[] entries = new ScrollEntry[3];
		for (int i = 0; i < entries.length; i++) {
			entries[i] = new ScrollEntry(images[i], labels[i], callout[i]); 
		}
		//entries[0].setCallout("aaaaaaa");
		PictureScrollField pictureScrollField = new PictureScrollField(300, 257); 

		pictureScrollField.setData(entries, 0);

		pictureScrollField.setHighlightStyle(HighlightStyle.ILLUMINATE);
		pictureScrollField.setHighlightBorderColor(Color.BLUE);
		pictureScrollField.setBackground(BackgroundFactory.createSolidTransparentBackground(Color.LIGHTBLUE, 100));
		pictureScrollField.setLabelsVisible(true);
		pictureScrollField.setTextColor(Color.YELLOWGREEN);
		
		add(pictureScrollField);
	}

}

相关推荐