问题场景TextInput 的clearButton 距离TextInput 的右边间距无法控制目前textInput的cancelButton暂时不支持调整间距此场景可以通过自定义组件实现,以下是参考Demo@Entry @Component struct TextInputExample { @State text: string = '' @State changeType:InputType = InputType.Number controller: TextInputController = new TextInputController() build() { Column() { Flex({direction: FlexDirection.Row}){ Stack(){ TextInput({ text: this.text, controller: this.controller }) .type(this.changeType) .placeholderFont({ size: 16, weight: 400 }) .width('100%') .height(56) .onChange((value: string) => { this.text = value }) Image($r('app.media.startIcon')) .margin({ left: 290 }) .width(20) .height(20) .onClick(() =>{ this.text = '' }) } } }.width('100%').height('100%').backgroundColor('#F1F3F5') } }
问题场景
TextInput 的clearButton 距离TextInput 的右边间距无法控制
目前textInput的cancelButton暂时不支持调整间距此场景可以通过自定义组件实现,以下是参考Demo