0

MapField の上に BitmapField が必要なアプリケーションを構築しています。この BitmapField はドラッグ可能である必要があります。つまり、BitmapField をクリックしてカーソルを移動すると、BitmapField はマップを移動せずに移動する必要があります。出来ますか??これどうやってするの..?

4

1 に答える 1

0

このコードを試してください:

public class Def extends MainScreen
{
VerticalFieldManager vertical;
BitmapField bitmapField;
int px=0,py=0;
public Def() 
{
    vertical=new VerticalFieldManager()
    {
        protected void sublayout(int maxWidth, int maxHeight) 
        {
            super.sublayout(Display.getWidth(),Display.getHeight());
            setExtent(Display.getWidth(),Display.getHeight());
        }       
    };
    vertical.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("background.png")));//put here map image;

    bitmapField=new BitmapField(Bitmap.getBitmapResource("rectanagle.png"));//For moving give small image;
    vertical.add(bitmapField);
    add(vertical);

}

protected boolean navigationMovement(int dx, int dy, int status, int time) 
{
    px=px+dx;
    py=py+dy;
    XYEdges xyEdges=new XYEdges(py, 0, 0, px);
    bitmapField.setPadding(xyEdges);
    vertical.invalidate();
    return super.navigationMovement(dx, dy, status, time);
}
}
于 2012-01-20T09:21:39.543 に答える