【发布时间】:2016-04-02 04:52:26
【问题描述】:
我在指定 ImageTextButton 中的文本大小时遇到了一些问题。我没有找到任何方法或属性来定义文本大小。我使用了下面的代码,但文本非常小。我希望文本在更高分辨率的设备上更大,因为我所有的代码都与屏幕的尺寸有关。位图字体是正确的方法吗? ImageTextButton 中的代码文本如何在更大的设备上更大?
font = new BitmapFont(Gdx.files.internal("font.fnt"));
ImageTextButton.ImageTextButtonStyle bts = new ImageTextButton.ImageTextButtonStyle();
bts.up = ninePatchDrawable;
bts.font=font;
bts.fontColor= Color.WHITE;
checkButton=new ImageTextButton("Text",bts);
checkButton.setBounds(Gdx.graphics.getWidth() * 0.2f, Gdx.graphics.getHeight() * 0.01f,Gdx.graphics.getWidth() * 0.24f,Gdx.graphics.getHeight()*0.08f);
stage.addActor(checkButton);
【问题讨论】:
-
我很难理解视口的概念。我最终使用了相对布局,到目前为止它们工作得很好。
标签: libgdx