跳转到内容

SusScrollView

SusScrollView

可滚动内容宿主 —— 垂直、水平,或两者兼有。

SusKit · 原子(商业)

在 Playground 中打开

SusKit · Atoms

属性

名称类型默认值
ModeProp<string>"vertical"
HideHorizontalProp<bool>true
HideVerticalProp<bool>false
WheelScrollSizeProp<float>48f

插槽

没有插槽。

事件

没有公开事件。

样式钩子

USS 类契约 — 无需改 C# 即可覆盖外观。状态通过这些类切换:

  • sus-scroll
  • sus-scroll__view
  • sus-scroll__view--native
  • unity-base-slider__dragger
  • unity-base-slider__tracker
  • unity-scroll-view__content-and-vertical-scroll-container
  • unity-scroller__high-button
  • unity-scroller__low-button
  • unity-scroller--horizontal
  • unity-scroller--vertical

用法

csharp
var scroll = new SusScrollView();
scroll.Mode.Value = "vertical";
scroll.HideHorizontal.Value = true;
scroll.WheelScrollSize.Value = 48f;
scroll.Add(longListRoot);
xml
<template>
  <sus:SusScrollView Mode="vertical">
    <!-- children go into the scroll content -->
  </sus:SusScrollView>
</template>

模式

vertical · horizontal · both

备注

  • 优先使用 Add(...) / ClearContent(),让子元素进入内部内容宿主,而不是 chrome。
  • 当包装与 flex column 布局冲突的 Unity 原生 collection view 时,SusScrollView.StyleNative(...) 会有帮助。