use of var3d.net.center.ActorGradient in project var3dframe by Var3D.
the class DialogTest method init.
@Override
public void init() {
// 设置背景
setBackground(new ActorGradient(400, 300, Color.CYAN, Color.CORAL));
// 设置标题(对话框使用show方法的时候不能省略父对象参数)
game.getLabel(R.strings.dialogTitle).touchOff().setPosition(getWidth() / 2, getHeight() - 20, Align.top).setColor(Color.RED).setStroke(Color.YELLOW).show(this);
// 关闭按钮
Button btn_close = game.getButton(R.image.pause_btn_bg).addClicAction().setPosition(getWidth() / 2, 50, Align.bottom).show(this);
btn_close.add(game.getLabel("关闭").setColor(Color.RED).getActor());
btn_close.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
game.removeDialog(DialogTest.this);
// or game.removeTopDialog();
// or game.removeAllDialog();
}
});
}
Aggregations