工具栏区
工具栏位于预编辑区与按键区之间,通常用于放置功能按键,如中英切换、打开常用语/剪贴板等。
工具栏配置属性
Section titled “工具栏配置属性”| 参数 | 类型 | 必选 | 说明 |
|---|---|---|---|
toolbarHeight | Float 或 String | 否 | 工具栏高度。支持 point 值或 vh 百分比写法,参见高度参数。 |
toolbarStyle | Object | 否 | 工具栏样式节点。 |
toolbarLayout | Object[] | 否 | 工具栏布局数组。布局写法参见布局。 |
toolbarStyle 支持以下属性:
| 参数 | 类型 | 必选 | 说明 |
|---|---|---|---|
insets | Insets | 否 | 工具栏内边距,用于缩小 toolbarLayout 的布局范围。 |
backgroundStyle | String | 否 | 引用工具栏背景样式节点。 |
配置示例:
toolbarHeight: '40'toolbarStyle: insets: top: 5 left: 10 bottom: 5 right: 10 backgroundStyle: toolbarBackgroundStyletoolbarLayout: - HStack: subviews: - Cell: switchInputModeButton - Cell: openCommonPhrasesButton - Cell: openClipboardButton横向候选字栏
Section titled “横向候选字栏”横向候选栏与工具栏位于同一区域。当出现横向候选栏时,工具栏将被隐藏。
横向候选栏配置属性:
| 参数 | 类型 | 必选 | 说明 |
|---|---|---|---|
horizontalCandidatesStyle | Object | 否 | 横向候选栏样式节点。 |
horizontalCandidatesLayout | Object[] | 否 | 横向候选栏布局数组。 |
horizontalCandidatesStyle 支持:
insets:横向候选栏内边距。backgroundStyle:引用横向候选栏背景样式节点。
配置示例:
horizontalCandidatesStyle: insets: { left: 3, bottom: 1, top: 3 } backgroundStyle: horizontalCandidatesBackgroundStyle
horizontalCandidatesLayout: - HStack: subviews: - Cell: horizontalCandidates - Cell: clearPreeditButton - Cell: expandButton需要注意的是:在布局的 Cell 中必须包含一个 type 为 horizontalCandidates 的单元格,用于显示横向候选字。
纵向候选字栏
Section titled “纵向候选字栏”纵向候选字栏是横向候选字栏的展开形态,它的位置及大小是工具栏区 + 按键区。当出现纵向候选字栏时,工具栏区、按键区、横向候选字栏将被隐藏。
纵向候选栏配置属性:
| 参数 | 类型 | 必选 | 说明 |
|---|---|---|---|
verticalCandidatesStyle | Object | 否 | 纵向候选栏样式节点。 |
verticalCandidatesLayout | Object[] | 否 | 纵向候选栏布局数组。 |
verticalCandidatesStyle 支持:
insets:纵向候选栏内边距。backgroundStyle:引用纵向候选栏背景样式节点。
配置示例:
verticalCandidatesStyle: insets: { top: 3, bottom: 3, left: 4, right: 4 } backgroundStyle: verticalCandidateBackgroundStyle
verticalCandidatesLayout: - HStack: subviews: - Cell: verticalCandidates - HStack: style: verticalLastRowStyle subviews: - Cell: verticalPageUpButton - Cell: verticalPageDownButton - Cell: collapseCandidatesButton - Cell: candidateBackspaceButton需要注意的是:在布局的 Cell 中必须包含一个 type 为 verticalCandidates 的单元格,用于显示纵向候选字。