We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.1.13 节的代码贴错了,随书提供的源码是正确的
改为
RelativeContainer() { Row() .width(100) .height(100) .backgroundColor('#FF3333') .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, //以父容器为锚点,竖直方向顶头对齐 middle: { anchor: '__container__', align: HorizontalAlign.Center } //以父容器为锚点,水平方向居中对齐 }) .id('row1') //设置锚点为row1 Row() { Image($r('app.media.icon')) } .height(100).width(100) .alignRules({ top: { anchor: 'row1', align: VerticalAlign.Bottom }, //以row1组件为锚点,竖直方向底端对齐 left: { anchor: 'row1', align: HorizontalAlign.Start } //以row1组件为锚点,水平方向开头对齐 }) .id('row2') //设置锚点为row2 Row() .width(100) .height(100) .backgroundColor('#FFCC00') .alignRules({ top: { anchor: 'row2', align: VerticalAlign.Top } }) .id('row3') //设置锚点为row3 Row() .width(100) .height(100) .backgroundColor('#FF9966') .alignRules({ top: { anchor: 'row2', align: VerticalAlign.Top }, left: { anchor: 'row2', align: HorizontalAlign.End }, }) .id('row4') //设置锚点为row4 Row() .width(100) .height(100) .backgroundColor('#FF66FF') .alignRules({ top: { anchor: 'row2', align: VerticalAlign.Bottom }, middle: { anchor: 'row2', align: HorizontalAlign.Center } }) .id('row5') //设置锚点为row5 } .width(300).height(300) .border({ width: 2, color: '#6699FF' })
The text was updated successfully, but these errors were encountered:
No branches or pull requests
p93
4.1.13 节的代码贴错了,随书提供的源码是正确的
改为
The text was updated successfully, but these errors were encountered: