英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论