HarmonyOS【ArkUI组件--Text】

1.Text文本显示组件

2.编写代码

在上一篇博客的基础上继续

HarmonyOS【ArkUI组件---Image组件】-CSDN博客

①新建ImagePage.ets

② 设置文本串

(1)base中的string.json

javascript 复制代码
 {
      "name": "width_label",
      "value": "Image Width:"
    }

(2) en_US中的string.json

javascript 复制代码
 {
      "name": "width_label",
      "value": "Image Width:"
    }

(3)zh_CN中的string.json

javascript 复制代码
{
      "name": "width_label",
      "value": "图片宽度:"
    }

③ImagePage 代码

javascript 复制代码
import font from '@ohos.font'
@Entry
@Component
struct Index {
  @State message: string = 'Hello World'

  build() {
    Row() {
      Column() {

        Image($r('app.media.app_icon'))
          .width(250)
          .interpolation(ImageInterpolation.High)
        Text($r('app.string.width_label'))
          .fontSize(20)
          .fontWeight(FontWeight.Bold)
      }

      .width('100%')
    }
    .height('100%')
  }
}

④效果如下

相关推荐
Exploring11 小时前
鸿蒙App开发,华为手机里装这一个就够了——「Hola万能计算器」到底有多万能?
harmonyos
想你依然心痛11 小时前
HarmonyOS 6 悬浮导航 + 沉浸光感:打造鸿蒙智能体驱动的沉浸式数据可视化驾驶舱
华为·信息可视化·ar·harmonyos·智能体
lqj_本人1 天前
鸿蒙electron跨端框架PC导出管家实战:把交付前的检查、复制和导出做成一个工坊
华为·electron·harmonyos
ai安歌1 天前
鸿蒙PC:鸿蒙electron跨端框架PC归档流水线实战:把散落文件整理成可追踪的桌面归档流程
华为·electron·harmonyos
lqj_本人1 天前
鸿蒙electron跨端框架PC课业板实战:课程、截止时间、提交物和风险都放到桌面上
服务器·electron·harmonyos
小雨青年1 天前
鸿蒙 HarmonyOS 6 | Pura X Max 鸿蒙原生适配 10:横屏下页面从上下结构改为左右结构
华为·harmonyos
lqj_本人1 天前
鸿蒙electron跨端框架PC灵光速记实战:让突然冒出来的想法先有地方落脚
harmonyos
Swift社区1 天前
HarmonyOS 鸿蒙PC三方库移植:vcpkg方式的 Port 脚本编写简明教程
华为·harmonyos
lqj_本人1 天前
鸿蒙electron跨端框架PC剪贴台实战:把高频短文本整理成一键可取的桌面片段库
华为·electron·harmonyos
ai安歌1 天前
鸿蒙PC:鸿蒙electron跨端框架PC素材情绪板实战:把灵感、配色和参考资料收进桌面创作面板
华为·electron·harmonyos