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%')
  }
}

④效果如下

相关推荐
Georgewu2 小时前
【HarmonyOS 5】桌面快捷方式功能实现详解
harmonyos
娅娅梨3 小时前
HarmonyOS-ArkUI 自定义弹窗
华为·harmonyos·arkts·arkui
陈奕昆3 小时前
3.3 HarmonyOS NEXT原子化服务开发:卡片设计、轻量部署与场景化编排实战
华为·harmonyos
上海张律师7 小时前
鸿蒙ArkTS+ArkUI仿微信消息列表页制作
harmonyos
王二蛋与他的张大花14 小时前
HarmonyOS运动开发:如何用mpchart绘制运动配速图表
harmonyos
程序员小刘14 小时前
【HarmonyOS 5】生活与服务开发实践详解以及服务卡片案例
华为·生活·harmonyos
小草帽学编程18 小时前
鸿蒙Next开发真机调试签名申请流程
android·华为·harmonyos
陈奕昆18 小时前
5.2 HarmonyOS NEXT应用性能诊断与优化:工具链、启动速度与功耗管理实战
华为·harmonyos
哼唧唧_1 天前
React Native开发鸿蒙运动健康类应用的项目实践记录
react native·harmonyos·harmony os5·运动健康