简体   繁体   English

如何为 Delphi FMX Android TFramedVertScrollBox 配置右垂直滚动?

[英]How to configure right vertical scroll for Delphi FMX Android TFramedVertScrollBox?

I have Delphi FMX Android TFramedVerScrollBox with:我有 Delphi FMX Android TFramedVerScrollBox 与:

Margins.Right:=20;
ShowScrollbars:=True;
TouchTargeExpansion.Right:=80;
Width:=800;

which has a set of TLayout components as a set of children with individual settings for each TLayout:它有一组 TLayout 组件作为一组孩子,每个 TLayout 都有单独的设置:

Align:=Top;
Anchors:=[akLeft, akTop, akRight]
Size.Wdith:=800; //But I guess this is irrelevant, as Size should be determined automatically for children with Align:=Top

My question is - how can I set properties in a way, that:我的问题是 - 我怎样才能以某种方式设置属性,即:

  • TLayout children components give some space in their correct size for scrollbars to become visible? TLayout 子组件以正确的大小为滚动条提供一些空间以使其可见? If TLayout.Padding.Right:=0, then TLayout children sit solidly in the place where the vertical scrollbar should be.如果 TLayout.Padding.Right:=0,则 TLayout 子项稳固地坐在垂直滚动条应该在的地方。 If TLayout.Padding.Right:=50, then the entire children are moved to the left side - this is really strange.如果 TLayout.Padding.Right:=50,那么整个子项都移到左侧——这真的很奇怪。 If width is computed automatically for the Align:=Tope children, then this Width should take into account the Padding of the children automatically and accordingly become smaller, less comprehensive.如果自动为 Align:=Tope 孩子计算宽度,那么这个 Width 应该自动考虑孩子的 Padding 并因此变得更小,更不全面。
  • Even I move the children to the left side and the scrollbar becomes visible - it is very, very narrow, just some 5-10 pixels.即使我将孩子移到左侧,滚动条也变得可见 - 它非常非常窄,只有大约 5-10 个像素。 How can I increase the width of the scrollbar of TFramedVerScrollBox?如何增加 TFramedVerScrollBox 滚动条的宽度?

First: "Padding" adds space to the inner side of the control (between the control borders and its children), while "Margins" adds space to the outer side of the control (to the borders of its Parent or between the control borders and another control within the same Parent).第一:“Padding”向控件的内侧添加空间(在控件边框与其子项之间),而“Margins”向控件的外侧添加空间(向其 Parent 的边框或在控件边框和控件边框之间)同一父项中的另一个控件)。

So when you need to set distance between a TLayout and its "Parent" border (Right border of the TFramedVertScrollBox) then you must go either for Padding in the TFramedVertScrollBox or for Margins in its children controls.因此,当您需要设置 TLayout 与其“父”边框(TFramedVertScrollBox 的右边框)之间的距离时,您必须为 TFramedVertScrollBox 中的填充或其子控件中的边距设置 go。

But it is not necessary to set space for scrollbars.但是没有必要为滚动条设置空间。 Because when a scrollbox (in Delphi apps like in anywhere else) is resized and its children are not completely visible, the scrollbox client area is resized automatically for letting space for showing scrollbars.因为当滚动框(在 Delphi 应用程序中,就像在其他任何地方一样)被调整大小并且其子项不完全可见时,滚动框客户区域会自动调整大小以留出显示滚动条的空间。 And even if you set "Margins" for children controls, the scrollbox client area is resized and the children margins are moved.即使您为子控件设置了“边距”,滚动框客户区的大小也会调整,子边距也会移动。 So you will get more margins that will ruin your UI design.所以你会得到更多的利润,这会破坏你的 UI 设计。

That size adaptation is common on Windows where the scrollbars are always completely shown with their classical aspect.这种大小调整在 Windows 上很常见,滚动条总是以其经典的外观完整显示。 While on Android, scrollbars are not explicitly shown, you may only see their "thumbs" when you try to drag on the side having the scrollbar.在 Android 上,滚动条没有明确显示,当您尝试在有滚动条的一侧拖动时,您可能只会看到它们的“拇指”。

Second: The width of the scrollbar in TFramedVertScrollBox, like all layout controls, is defined by the style.第二:TFramedVertScrollBox中滚动条的宽度,和所有的布局控件一样,是由样式定义的。 You have to customize the style or create your own style where you can set the size and even the position of the scrollbar.您必须自定义样式或创建自己的样式,您可以在其中设置滚动条的大小甚至 position。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM