HarmonyOS 老人模式?

老人模式,放大系统字体等

阅读 467
1 个回答

参考如下demo

@Entry
@Component
struct Pagebutton {
  @State imagewidth: number = 30;
  @State fontwight: number = 30;
  build() {

    Column() {
      Row(){
        Text($r('app.string.text')).fontSize(this.fontwight)
        TextInput({placeholder:$r('app.string.image_width'),text:this.imagewidth.toString()})
          .type(InputType.Number)
          .onChange(value=>{
            this.fontwight=parseInt(value)
          }).backgroundColor('#fff')
      }.justifyContent(FlexAlign.SpaceBetween).width('100%').padding({
        left:10,
        right:10
      })
      Divider().width('91%')
      Row({space:10}){
        Button('点击增加字体大小').onClick(()=>{

          this.fontwight+=10
        })
        Button('点击减少字体大小').onClick(()=>{
          this.fontwight-=10
        })
      }.width('100%')
      .justifyContent(FlexAlign.SpaceEvenly)
      .margin({
        top:50
      })

      Row(){

        Slider({
          min:0,
          max:100,
          value:this.imagewidth,
          step:10,
          style:SliderStyle.OutSet,
          direction:Axis.Horizontal,
          reverse:false
        }).showTips(true).blockColor('#36d').onChange(value=>{
          console.log('value',value)
          this.imagewidth=Math.trunc(value)//取整
          console.log(typeof value)
        }).trackThickness(10).width('100%')
      }.margin({
        top:50
      })

    }
    .width('100%')
  }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进