2014-10-18 88 views
0

如何將多行Label停靠在屏幕底部?有Label.setY()方法,但它的工作方式有些神祕,對我來說毫無意義。我可以通過getWrappedBounds()獲得標籤的大致高度,但我無法弄清楚如何使用標籤的高度來設置標籤的位置。libgdx - scene2d.ui標籤位置

回答

1

您不能直接定位標籤,您必須添加到使用WidgetGroup的類(如Table)。或者你也可以的容器內被認爲是比表更輕量級],添加標籤來:

Label testLabel = new Label("testme",super.getSkin(),"gameName"); 
Container labelContainer = new Container(testLabel); 
labelContainer.bottom(); 

那麼標籤應在底部

0

顯示你應該先準備好您的標籤然後放置它:

skorTextLabel = new Label("Score " + level_skoru, skorTextStyle); 
skorTextLabel.setPosition(
      ekran_genisligi * 0.5f - skorTextLabel.getWidth() * 0.5f, 
      skorTextLabel.getHeight() * 0.3f); 

「skorTextLabel.getHeight()* 0.3f」距離底部的距離。