我正在尝试做一个进度条,旋钮和背景是九个补丁。我得到左右两边的旋钮边距
ScreenShot:ProgressBar
我知道它是因为它的背景和旋钮是九补丁,我测试了它。有人知道怎么解决这个问题吗?谢谢
下面是代码
ProgressBarStyle pbStyle = new ProgressBarStyle(guiSkin.getDrawable("background"),guiSkin.getDrawable("knob"));
pbStyle.knobBefore = pbStyle.knob;
pb = new ProgressBar(0, 100, 1, false, pbStyle);
pb.setSize(Gdx.graphics.getWidth(), 10);
pb.setPosition(0, pb.getHeight() * 2);
stage.addActor(pb);
pb.setValue(100);
ScrennShot 9-修补程序:
发布于 2016-08-08 09:52:11
我通过添加以下代码找到了解决方案:
//for the knobBefore
pbStyle.knobBefore.setLeftWidth(0);
pbStyle.knobBefore.setRightWidth(0);
//for the background
pbStyle.background.setLeftWidth(0);
pbStyle.background.setRightWidth(0);
对于垂直progressBar,请使用.setBottomHeight()
和.setTopHeight();
我希望这能帮到你!
https://stackoverflow.com/questions/35494106
复制相似问题