我的LWUIT视频组件浮动在我的命令上。知道如何解决这个问题吗?我的代码如下。
public void showQuickProfileForm() {
Form f = new Form();
VideoComponent videoComponent = null;
try {
videoComponent = VideoComponent.createVideoPeer("capture://image");
} catch (IOException e) {
// e.printStackTrace();
try {
videoComponent = VideoComponent.createVideoPeer("capture://video");
} catch (IOException ex) {
// ex.printStackTrace();
}
}
videoComponent.setPreferredH((int) (Display.getInstance().getDisplayHeight() * 0.8));
videoComponent.setPreferredW(Display.getInstance().getDisplayWidth());
Player player = (Player) videoComponent.getNativePeer();
try {
player.realize();
player.start();
} catch (MediaException ex) {
ex.printStackTrace();
}
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
videoComponent.start();
f.addComponent(videoComponent);
f.addCommand(new Command("capture", 1));
f.show();
}
public void actionPerformed(ActionEvent evt) {
if (evt.getCommand().getId() == 1) {
// midlet.destroyApp(true);
Form d = new Form();
d.show();
}
}
答案 0 :(得分:0)
初始化视频控制后,请根据需要更改宽度和高度:
videoControl.setDisplaySize(width + 4, height - 25);