我正在尝试将我的文本正确地与VBox对齐。我正在使用的VBox有一个背景图片。然后标签与图像重叠。这基本上是创建我想要的按钮。
问题是我使用的背景图像底部有阴影效果。因此,当我在VBox上使用verticalAlign =“middle”时,它实际上并不居中。
我尝试过更改VBox和标签y值,top& bottom属性和verticalCenter属性。无论如何,它们似乎都没有向上或向下移动标签。我很困惑为什么这些不会改变标签。
这是我当前的代码,没有任何y,top,bottom或verticalCenter设置。
<mx:VBox height="70" width="175" backgroundImage="{buttonBackground}" verticalAlign="middle" horizontalAlign="center" backgroundSize="100%" buttonMode="true" useHandCursor="true" mouseChildren="false" click="{controller.goToPage('configPg')}">
<mx:Label text="Configure" buttonMode="true" useHandCursor="true" mouseChildren="false" fontSize="24" color="white"/>
</mx:VBox>
非常感谢任何帮助。
由于
答案 0 :(得分:0)
我能够通过调整paddingBottom来解决这个问题。感谢drkstr1的答案。
您尝试的所有属性在布局容器中都无关紧要。使用字体样式定位文本(EG.padding,verticalAlign,textAlign等),或者如果VBox中没有其他内容,则使用Canvas手动定位。 - drkstr1 11月14日17:25