1
我想为位图字段显示的放大/缩小图像添加功能。
我有这个搜索,但不能得到任何有用的提示,
任何人可以告诉我如何添加用户界面和功能的缩放图像输入/输出。如何在位图字段添加放大/缩小功能?
我想为位图字段显示的放大/缩小图像添加功能。
我有这个搜索,但不能得到任何有用的提示,
任何人可以告诉我如何添加用户界面和功能的缩放图像输入/输出。如何在位图字段添加放大/缩小功能?
试试这个代码
public final class ZoomScreenDemo extends UiApplication
{
public static void main(final String[] args)
{
// Create a new instance of the application and make the currently
// running thread the application's event dispatch thread.
UiApplication app = new ZoomScreenDemo();
app.enterEventDispatcher();
}
/**
* Creates a new ZoomScreenDemo object
*/
public ZoomScreenDemo()
{
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
Dialog.alert("Click trackball or screen to zoom");
}
});
pushScreen(new ZoomScreenDemoScreen());
}
public final static class ZoomScreenDemoScreen extends MainScreen
{
private EncodedImage _image;
/**
* Creates a new ZoomScreenDemoScreen object
*/
public ZoomScreenDemoScreen()
{
setTitle("Zoom Screen Demo");
_image = EncodedImage.getEncodedImageResource("img/building.jpg");
BitmapField bitmapField = new BitmapField(_image.getBitmap(), FIELD_HCENTER | FOCUSABLE);
add(bitmapField);
}
/**
* @see Screen#navigationClick(int, int)
*/
protected boolean navigationClick(int status, int time)
{
// Push a new ZoomScreen if track ball or screen is clicked
UiApplication.getUiApplication().pushScreen(new ZoomScreen(_image));
return true;
}
/**
* @see Screen#touchEvent(TouchEvent)
*/
protected boolean touchEvent(TouchEvent message)
{
if(message.getEvent() == TouchEvent.CLICK)
{
UiApplication.getUiApplication().pushScreen(new ZoomScreen(_image));
}
return super.touchEvent(message);
}
}
}
可我们地图或缩小屏幕添加UI像变焦? – 2012-03-22 09:09:49
是的。尝试我发布的代码顶部。 – Signare 2012-03-22 09:14:16
我可以添加一些自定义控件的放大/缩小其他点击轨迹球或筛选? – 2012-03-23 03:37:33