<bdo id='l6XC6'></bdo><ul id='l6XC6'></ul>

        <small id='l6XC6'></small><noframes id='l6XC6'>

      1. <tfoot id='l6XC6'></tfoot>
      2. <legend id='l6XC6'><style id='l6XC6'><dir id='l6XC6'><q id='l6XC6'></q></dir></style></legend>
        <i id='l6XC6'><tr id='l6XC6'><dt id='l6XC6'><q id='l6XC6'><span id='l6XC6'><b id='l6XC6'><form id='l6XC6'><ins id='l6XC6'></ins><ul id='l6XC6'></ul><sub id='l6XC6'></sub></form><legend id='l6XC6'></legend><bdo id='l6XC6'><pre id='l6XC6'><center id='l6XC6'></center></pre></bdo></b><th id='l6XC6'></th></span></q></dt></tr></i><div id='l6XC6'><tfoot id='l6XC6'></tfoot><dl id='l6XC6'><fieldset id='l6XC6'></fieldset></dl></div>
      3. 如何获得带有包装文本的标签?

        时间:2023-05-19
      4. <tfoot id='rz7Tx'></tfoot>
            <i id='rz7Tx'><tr id='rz7Tx'><dt id='rz7Tx'><q id='rz7Tx'><span id='rz7Tx'><b id='rz7Tx'><form id='rz7Tx'><ins id='rz7Tx'></ins><ul id='rz7Tx'></ul><sub id='rz7Tx'></sub></form><legend id='rz7Tx'></legend><bdo id='rz7Tx'><pre id='rz7Tx'><center id='rz7Tx'></center></pre></bdo></b><th id='rz7Tx'></th></span></q></dt></tr></i><div id='rz7Tx'><tfoot id='rz7Tx'></tfoot><dl id='rz7Tx'><fieldset id='rz7Tx'></fieldset></dl></div>

              <legend id='rz7Tx'><style id='rz7Tx'><dir id='rz7Tx'><q id='rz7Tx'></q></dir></style></legend>

              <small id='rz7Tx'></small><noframes id='rz7Tx'>

                • <bdo id='rz7Tx'></bdo><ul id='rz7Tx'></ul>

                    <tbody id='rz7Tx'></tbody>
                  本文介绍了如何获得带有包装文本的标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我试过以下代码:

                  Label label = new Label(reallyLongString, skin);
                  label.setWrap(true);
                  label.setWidth(100); // or even as low as 10
                  table.add(label);
                  ...
                  

                  但我得到的只是一条很宽的线,从屏幕上划出.如何获取带有换行文本的标签?

                  and yet all I get is a very wide line that draws off the screen. How to get a Label with wrapped text?

                  推荐答案

                  这与 slider always has default width 或 "滑块始终具有默认宽度".

                  您需要将该标签放入表格中,并将正确大小添加到标签所在表格的单元格中.

                  You need to put that label into a table and add the right size to the cell of the table where the label is.

                  UI 小部件不设置自己的大小和位置.相反,父窗口小部件设置每个孩子的大小和位置.小部件提供父级可以用作提示的最小、首选和最大大小.一些父窗口小部件,例如 Table,可以限制子窗口的大小和位置.要在布局中为小部件指定特定尺寸,小部件的最小、首选和最大尺寸将保持不变,并在父级中设置尺寸限制.

                  UI widgets do not set their own size and position. Instead, the parent widget sets the size and position of each child. Widgets provide a minimum, preferred, and maximum size that the parent can use as hints. Some parent widgets, such as Table, can be given constraints on how to size and position the children. To give a widget a specific size in a layout, the widget's minimum, preferred, and maximum size are left alone and size constraints are set in the parent.

                  来源:来自 libgdx wiki Scene2D

                  解决办法:

                  Label label = new Label(reallyLongString, skin);
                  label.setWrap(true);
                  label.setWidth(100); // or even as low as 10
                  table.add(label).width(10f);// <--- here you define the width
                  

                  这篇关于如何获得带有包装文本的标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:LibGDX 0.9.9 - 在环境中应用立方体贴图 下一篇:LibGDX - 使用 Modelbuilder.createBox 将单个纹理映射到

                  相关文章

                  最新文章

                  <small id='k63WB'></small><noframes id='k63WB'>

                  <i id='k63WB'><tr id='k63WB'><dt id='k63WB'><q id='k63WB'><span id='k63WB'><b id='k63WB'><form id='k63WB'><ins id='k63WB'></ins><ul id='k63WB'></ul><sub id='k63WB'></sub></form><legend id='k63WB'></legend><bdo id='k63WB'><pre id='k63WB'><center id='k63WB'></center></pre></bdo></b><th id='k63WB'></th></span></q></dt></tr></i><div id='k63WB'><tfoot id='k63WB'></tfoot><dl id='k63WB'><fieldset id='k63WB'></fieldset></dl></div>
                  <legend id='k63WB'><style id='k63WB'><dir id='k63WB'><q id='k63WB'></q></dir></style></legend>
                    1. <tfoot id='k63WB'></tfoot>

                        <bdo id='k63WB'></bdo><ul id='k63WB'></ul>