目前textInput的cancelButton暂时不支持清除右边距,可以使用row容器布局,并将justifyContent属性设置为FlexAlign.SpaceBetween进行实现。参考demo:Row(){ TextInput({ placeholder: '选填', text: '' }) .placeholderColor("#99262626") .textAlign(TextAlign.End) .placeholderFont({ size: 14 }) .fontColor(Color.Black) .borderRadius(0) .backgroundColor(Color.Transparent) .fontSize(14) .padding(0) .onChange((value: string) => { this.inviteCode = value; }).width('95%') Image($r("app.media.app_icon")).height(20).onClick(() => {}) }.justifyContent(FlexAlign.SpaceBetween).width('100%')
目前textInput的cancelButton暂时不支持清除右边距,可以使用row容器布局,并将justifyContent属性设置为FlexAlign.SpaceBetween进行实现。
参考demo: