概要
var root = new VisualElement(); root.style.flexDirection = FlexDirection.Row;
VisualElement
の style.flexDirection
に FlexDirection.Row
を指定する
これだけだと要素が左に表示されてしまう
var root = new VisualElement(); root.style.flexDirection = FlexDirection.Row; prevButton.style.flexGrow = 1; nextButton.style.flexGrow = 1; root.Add( prevButton ); root.Add( nextButton );
子要素の style.flexGrow
に 1
を指定すると横幅いっぱいに同じ幅で表示される