Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
1918fa54
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1918fa54
编写于
9月 28, 2022
作者:
S
sienna1128
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update docs
Signed-off-by:
N
sienna1128
<
lixiaoyan45@huawei.com
>
上级
3896ae9e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
30 deletion
+28
-30
zh-cn/application-dev/reference/arkui-ts/figures/textstyle.png
.../application-dev/reference/arkui-ts/figures/textstyle.png
+0
-0
zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219662673.png
...ference/arkui-ts/figures/zh-cn_image_0000001219662673.png
+0
-0
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md
.../reference/arkui-ts/ts-universal-attributes-text-style.md
+28
-30
未找到文件。
zh-cn/application-dev/reference/arkui-ts/figures/textstyle.png
0 → 100644
浏览文件 @
1918fa54
167.1 KB
zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219662673.png
已删除
100644 → 0
浏览文件 @
3896ae9e
42.5 KB
zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md
浏览文件 @
1918fa54
...
...
@@ -12,11 +12,11 @@
| 名称 | 参数类型 | 描述 |
| -----------| ---------------------------------------- | ------------------------------------ |
| fontColor |
[
ResourceColor
](
ts-types.md#resourcecolor
)
| 设置
文本
颜色。 |
| fontSize | Length
\|
[
Resource
](
ts-types.md#resource
)
| 设置
文本尺寸,Length为number类型时,使用fp单位
。 |
| fontStyle |
[
FontStyle
](
ts-appendix-enums.md#fontstyle
)
| 设置
文本的
字体样式。
<br>
默认值:FontStyle.Normal |
| fontColor |
[
ResourceColor
](
ts-types.md#resourcecolor
)
| 设置
字体
颜色。 |
| fontSize | Length
\|
[
Resource
](
ts-types.md#resource
)
| 设置
字体大小,Length为number类型时,使用fp单位。字体默认大小10
。 |
| fontStyle |
[
FontStyle
](
ts-appendix-enums.md#fontstyle
)
| 设置字体样式。
<br>
默认值:FontStyle.Normal |
| fontWeight | number
\|
[FontWeight](ts-appendix-enums.md#fontweight)
\|
string | 设置文本的字体粗细,number类型取值[100,
900],取值间隔为100,默认为400,取值越大,字体越粗。string类型仅支持number类型取值的字符串形式,例如"400",以及"bold"、"bolder"、"lighter"、"regular"、"medium",分别对应FontWeight中相应的枚举值。
<br/>
默认值:FontWeight.Normal |
| fontFamily | string
\|
[
Resource
](
ts-types.md#resource
)
| 设置
文本的字体列表。使用多个字体,使用','进行分割,优先级按顺序生效。例如:'Arial,
sans-serif'。
|
| fontFamily | string
\|
[
Resource
](
ts-types.md#resource
)
| 设置
字体列表。默认字体'HarmonyOS Sans',且当前只支持这种字体。使用多个字体,使用','进行分割,优先级按顺序生效。
|
## 示例
...
...
@@ -29,40 +29,38 @@ struct TextStyleExample {
build
()
{
Column
({
space
:
5
})
{
Text
(
'
default text
'
)
Text
(
'
text font color red
'
)
.
fontColor
(
Color
.
Red
)
Text
(
'
text font size 20
'
)
.
fontSize
(
20
)
Text
(
'
text font style Italic
'
)
.
fontStyle
(
FontStyle
.
Italic
)
Text
(
'
text fontWeight bold
'
)
.
fontWeight
(
700
)
Text
(
'
text fontFamily sans-serif
'
)
.
fontFamily
(
'
sans-serif
'
)
Text
(
'
red 20 Italic bold cursive text
'
)
Divider
()
Text
(
'
text font color red
'
).
fontColor
(
Color
.
Red
)
Divider
()
Text
(
'
text font default
'
)
Text
(
'
text font size 10
'
).
fontSize
(
10
)
Text
(
'
text font size 10fp
'
).
fontSize
(
'
10fp
'
)
Text
(
'
text font size 20
'
).
fontSize
(
20
)
Divider
()
Text
(
'
text font style Italic
'
).
fontStyle
(
FontStyle
.
Italic
)
Divider
()
Text
(
'
text fontWeight bold
'
).
fontWeight
(
700
)
Text
(
'
text fontWeight lighter
'
).
fontWeight
(
FontWeight
.
Lighter
)
Divider
()
Text
(
'
red 20 Italic bold text
'
)
.
fontColor
(
Color
.
Red
)
.
fontSize
(
20
)
.
fontStyle
(
FontStyle
.
Italic
)
.
fontWeight
(
700
)
.
fontFamily
(
'
cursive
'
)
.
textAlign
(
TextAlign
.
Center
)
.
width
(
'
90%
'
)
Text
(
'
Orange 18 Normal source-sans-pro text
'
)
.
fontWeight
(
FontWeight
.
Bold
)
Divider
()
Text
(
'
Orange 18 Normal text
'
)
.
fontColor
(
Color
.
Orange
)
.
fontSize
(
18
)
.
fontStyle
(
FontStyle
.
Normal
)
.
fontWeight
(
400
)
.
fontFamily
(
'
source-sans-pro,cursive,sans-serif
'
)
}.
width
(
'
100%
'
)
}
}
```


编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录