如何调整 Fyne 中的输入框大小

huangapple go评论120阅读模式
英文:

How to resize an entry box in fyne

问题

需要你的帮助来调整我的应用程序中的一个小部件的大小。我有以下代码:

middleLines := container.NewHBox(app.ListLines, linesDetails)
middleLines.Resize(fyne.NewSize(1000, 10000))

containerLines := container.New(layout.NewBorderLayout(toolbarLines, nil, middleLines, nil), toolbarLines, middleLines)middleCase := container.NewHBox(app.ListCases, casesDetails)
	containerCases := container.New(layout.NewBorderLayout(toolbarCases, nil, middleCase, nil), toolbarCases, middleCase)
	tabs := container.NewAppTabs(
		container.NewTabItem("Lines", containerLines),
		container.NewTabItem("Cases", containerCases),
	)

这是我的主窗口,但是当我运行时,出现了以下问题:
Main App
如你所见,我的文本输入框和列表太小,无法显示文本。

我该如何调整这些文本框和列表的大小?

英文:

Needing your help to resize a widget of fine on my app I have the following:

middleLines := container.NewHBox(app.ListLines, linesDetails)
middleLines.Resize(fyne.NewSize(1000, 10000))

containerLines := container.New(layout.NewBorderLayout(toolbarLines, nil, middleLines, nil), toolbarLines, middleLines)middleCase := container.NewHBox(app.ListCases, casesDetails)
	containerCases := container.New(layout.NewBorderLayout(toolbarCases, nil, middleCase, nil), toolbarCases, middleCase)
	tabs := container.NewAppTabs(
		container.NewTabItem("Lines", containerLines),
		container.NewTabItem("Cases", containerCases),
	)

that's my main window but when I run I have the following:
Main App
As you see my text entry and my list is to small to show the text.

How can I resize this textboxes and list?

答案1

得分: 2

小部件的大小由容器布局控制,因此手动调用Resize不会产生效果。请参阅https://developer.fyne.io/faq/layout

您将middleLines放置在边框布局的左侧元素中(布局的参数为顶部、底部、左侧、右侧)-边缘始终会收缩,以便中心可以扩展。如果将其从left参数中移除,则它将在中心扩展以填充空间。

英文:

Widget size is controlled by the container layout, so manually calling Resize won't have effect. See https://developer.fyne.io/faq/layout

You are placing the middleLines in the left element of a border layout (the parameters of the layout are top, bottom, left, right) - the edges are always shrunk so that the center can expand. If you remove it from the left parameter then it will expand in the center to fill the space.

huangapple
  • 本文由 发表于 2021年6月16日 23:18:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/68005561.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定