HarmonyOS怎么调整Radio的选项框的位置

将Radio的width设置为100%的情况下,怎么调整选相关的位置。demo如下:

@Entry 
@Component 
export struct Test { 
  build() { 
    Column() { 
      Radio({ value: "radio1", group: 'radioGroup' }) 
        .radioStyle({ checkedBackgroundColor: $r('app.color.selectEnableColor') }) 
        .checked(true) 
        .height(20) 
        .width(20) 
        .foregroundColor($r('app.color.selectEnableColor')) 
        .onChange((isChecked: boolean) => { 
          console.log('Radio1 status is ' + isChecked) 
        }) 
        .alignRules({ 
          center: { anchor: "__container__", align: VerticalAlign.Center } 
        }) 
        .width("100%") 
        .id("column1") 
    } 
  } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
HarmonyOS
2024-08-09 15:38:57
961浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

demo参考如下:

@Entry 
@Component 
export struct Test { 
  build() { 
    Column() { 
      Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { 
        Column() { 
          Radio({ value: "radio1", group: 'radioGroup' }) 
            .radioStyle({ checkedBackgroundColor: '#000' }) 
            .checked(true) 
            .height(20) 
            .width(20) 
            .foregroundColor(Color.Red) 
            .onChange((isChecked: boolean) => { 
              console.log('Radio1 status is ' + isChecked) 
            }) 
            .alignRules({ 
              center: { anchor: "__container__", align: VerticalAlign.Center } 
            }) 
            .id("column1") 
        } 
      } 
    } 
  } 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
分享
微博
QQ
微信
回复
2024-08-09 17:19:05


相关问题
Scroll子组件展示位置如何调整
3299浏览 • 1回复 待解决
HarmonyOS tabs中tabbar整体位置调整
565浏览 • 1回复 待解决
鸿蒙如何调整组件位置
8199浏览 • 1回复 待解决
HarmonyOS Radio 组件
589浏览 • 1回复 待解决
怎么把应用放入文件打开选项
303浏览 • 0回复 待解决
HarmonyOS radio组件问题
1201浏览 • 1回复 待解决
HarmonyOS web_webview怎么调整字体
514浏览 • 1回复 待解决
如何调整设置相机焦距
1450浏览 • 1回复 待解决