배경 이미지 위에 하나의 이미지 위치를 설정하고 싶습니다. 위치는 화면 어디에서나 가능합니다.배경 화면 이미지 위에 검은 딸기 이미지
샘플 코드 또는 링크 또는 자습서가 있습니까? 여기
배경 이미지 위에 하나의 이미지 위치를 설정하고 싶습니다. 위치는 화면 어디에서나 가능합니다.배경 화면 이미지 위에 검은 딸기 이미지
샘플 코드 또는 링크 또는 자습서가 있습니까? 여기
이다 나는 그것을 할 방법 :
이 4.6.0에서 작동하고 나중에 때문에 BackgroundFactory 당신이 레이아웃 매니저 클래스를 만들고 그 위치를 사용할 수있는 여러 이미지의 경우
// Create the background image and the image field to put on top
Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource(bgImgPath);
Bitmap bmp = Bitmap.getBitmapResource(imgPath);
BitmapField imgField = new BitmapField(bmp);
// Create the field manager
VerticalFieldManager manager = new VerticalFieldManager()
{
// Overide the sublayout of the field manager to set the position of
// the image directly
protected void sublayout(int width, int height)
{
setPositionChild(imgField, positionX, positionY)
setExtent(width, height)
}
};
// Set the background of the field manager
manager.setBackground(bg);
// add the bitmap field to the field manager
manager.add(imgField);
// add the field manager to the screen
add(manager);
모든 이미지 곳 비슷한 기술을 사용하여 그 (것)들을 원한다. 레이아웃 관리자를 만들고 사용하는 방법에 대한 자습서가 있습니다. 여기에서 다시 시도해 보겠습니다.
4.5.0 이하를 사용하는 경우 레이아웃 관리자를 사용하고 다른 이미지와 마찬가지로 배경 이미지를 추가하지만 맨 아래에 그릴 수 있도록 추가하십시오.
내가 말했듯이 내가 레이아웃 관리자를위한 튜토리얼을 찾아 보겠다. 당신은 위치에 다른 이미지를 배치 할 수 있습니다 당신이뿐만 아니라 배경 이미지를 지정할 수 있습니다 여기에 관리자 클래스 를 확장하는 클래스를 만들 수 있습니다
당신은
class Test extends MainScreen
{
Test()
{
super();
Bitmap bmp = Bitmap.getBitmapResource("image1.png");
BitmapField bmpf = new BitmapField(bmp);
Mymanager obj = new Mymanager();
obj.add(bmpf);
}
}
class Mymanager extends Manager
{
final Bitmap background = Bitmap.getBitmapResource("back.png");
protected void paint(Graphics g)
{
g.drawrect(0,0,background.getWidth,background.getheight,background,0,0);
}
protected void sublayout(int width, int height)
{
Field field = getfield(0);
layoutchild(field,100,100);
setPositionchild(field,20,10);
setExtent(Display.getWidth,Display.getHeight);
}
}
덕분에 샘플 코드를 많이합니다. 내가 4.5.0 버전의 응용 프로그램을 개발할 때 자습서를 기다리고 있습니다. – Master
하나가 있습니다 : http://docs.blackberry.com/en/developers/deliveryables/1180/development.pdf#24 24 페이지에 있습니다. pdf. 전체 설명서는 4.5.0에서 제공되므로 모두 잘 작동해야합니다. –