TextInput按压态背景色如何修改

TextInput按压态背景色如何修改

HarmonyOS
2024-01-21 12:14:51
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
yuxiao2000

可以使用ArkUI多态样式,修改按压态背景色。

代码示例

@Entry 
@Component 
struct Index { 
  @Styles 
  pressedStyles() { 
    .backgroundColor(Color.White) 
  } 
 
  build() { 
    Row() { 
      Column() { 
        TextInput() 
          .backgroundColor(Color.White) 
          .stateStyles({ 
            pressed: this.pressedStyles, 
          }) 
      } 
      .width('100%') 
    } 
    .height('100%') 
  } 
}

参考链接

多态样式

分享
微博
QQ
微信
回复
2024-01-22 14:48:03