1# Linear Layout 2 3 4## Overview 5 6Linear layout is the most frequently used layout in development, built with the [\<Row>](../reference/arkui-ts/ts-container-row.md) and [\<Column>](../reference/arkui-ts/ts-container-column.md) linear containers. The linear layout is the basis of other layouts. Its child components are arranged in sequence linearly in the horizontal direction, as in a **\<Row>** container, or vertical direction, as in a **\<Column>** container. 7 8 9 **Figure 1** Child component arrangement in a \<Column> container 10 11![arrangement-child-elements-column](figures/arrangement-child-elements-column.png) 12 13 14 **Figure 2** Child component arrangement in a \<Row> container 15 16![arrangement-child-elements-row](figures/arrangement-child-elements-row.png) 17 18 19## Basic Concepts 20 21- Layout container: container component that is able to lay out other elements as its child elements. The layout container calculates the size of its child elements and arranges the layout. 22 23- Layout child element: element inside the layout container. 24 25- Main axis: axis along which child elements are laid out by default in the linear layout container. The main axis is horizontal for the **\<Row>** container and vertical for the **\<Column>** container. 26 27- Cross axis: axis that runs perpendicular to the main axis. The cross axis is vertical for the **\<Row>** container and horizontal for the **\<Column>** container. 28 29- Spacing: vertical distance between child elements. 30 31 32## Spacing of Layout Child Elements in Arrangement Direction 33 34In the layout container, use the **space** attribute to equally space child elements in the arrangement direction. 35 36 37### In \<Column> Container 38 39 **Figure 3** Layout child element spacing in the arrangement direction in the \<Column> container 40 41![arrangement-direction-column](figures/arrangement-direction-column.png) 42 43```ts 44Column({ space: 20 }) { 45 Text('space: 20').fontSize(15).fontColor(Color.Gray).width('90%') 46 Row().width('90%').height(50).backgroundColor(0xF5DEB3) 47 Row().width('90%').height(50).backgroundColor(0xD2B48C) 48 Row().width('90%').height(50).backgroundColor(0xF5DEB3) 49}.width('100%') 50``` 51 52 53![arrangement-direction-column-sample](figures/arrangement-direction-column-sample.png) 54 55 56### In \<Row> Container 57 58 **Figure 4** Layout child element spacing in the arrangement direction in the \<Row> container 59 60![arrangement-direction-row](figures/arrangement-direction-row.png) 61 62 63```ts 64Row({ space: 35 }) { 65 Text('space: 35').fontSize(15).fontColor(Color.Gray) 66 Row().width('10%').height(150).backgroundColor(0xF5DEB3) 67 Row().width('10%').height(150).backgroundColor(0xD2B48C) 68 Row().width('10%').height(150).backgroundColor(0xF5DEB3) 69}.width('90%') 70``` 71 72![en-us_image_0000001562700509](figures/en-us_image_0000001562700509.png) 73 74 75## Alignment of Layout Child Elements Along Cross Axis 76 77In the layout container, use the **alignItems** attribute to set the alignment mode of child elements along the cross axis. The alignment performance is consistent across screens of various sizes. The value is of the [VerticalAlign Type](../reference/arkui-ts/ts-appendix-enums.md#verticalalign) type when the cross axis is in the vertical direction and the [HorizontalAlign](../reference/arkui-ts/ts-appendix-enums.md#horizontalalign) type when the cross axis is in the horizontal direction. 78 79The layout container also provides the **alignSelf** attribute to control the alignment mode of a single child element along the main axis. This attribute has a higher priority than the **alignItems** attribute. This means that, if **alignSelf** is set, it will overwrite the **alignItems** setting on the corresponding child element. 80 81 82### Horizontal Alignment of Layout Child Elements in \<Column> Container 83 84 **Figure 5** Horizontal alignment of layout child elements in the \<Column> container 85 86![horizontal-arrangement-child-column](figures/horizontal-arrangement-child-column.png) 87 88- **HorizontalAlign.Start**: Child elements are left aligned horizontally. 89 90 ```ts 91 Column({}) { 92 Column() { 93 }.width('80%').height(50).backgroundColor(0xF5DEB3) 94 95 Column() { 96 }.width('80%').height(50).backgroundColor(0xD2B48C) 97 98 Column() { 99 }.width('80%').height(50).backgroundColor(0xF5DEB3) 100 }.width('100%').alignItems(HorizontalAlign.Start).backgroundColor('rgb(242,242,242)') 101 ``` 102 103 ![en-us_image_0000001511580964](figures/en-us_image_0000001511580964.png) 104 105- **HorizontalAlign.Center**: Child elements are center-aligned horizontally. 106 107 ```ts 108 Column({}) { 109 Column() { 110 }.width('80%').height(50).backgroundColor(0xF5DEB3) 111 112 Column() { 113 }.width('80%').height(50).backgroundColor(0xD2B48C) 114 115 Column() { 116 }.width('80%').height(50).backgroundColor(0xF5DEB3) 117 }.width('100%').alignItems(HorizontalAlign.Center).backgroundColor('rgb(242,242,242)') 118 ``` 119 120 ![en-us_image_0000001562820897](figures/en-us_image_0000001562820897.png) 121 122- **HorizontalAlign.End**: Child elements are right-aligned horizontally. 123 124 ```ts 125 Column({}) { 126 Column() { 127 }.width('80%').height(50).backgroundColor(0xF5DEB3) 128 129 Column() { 130 }.width('80%').height(50).backgroundColor(0xD2B48C) 131 132 Column() { 133 }.width('80%').height(50).backgroundColor(0xF5DEB3) 134 }.width('100%').alignItems(HorizontalAlign.End).backgroundColor('rgb(242,242,242)') 135 ``` 136 137 ![en-us_image_0000001511421348](figures/en-us_image_0000001511421348.png) 138 139 140### Vertical Alignment of Layout Child Elements in \<Row> Container 141 142 **Figure 6** Vertical alignment of layout child elements in \<Row> container 143 144![horizontal-arrangement-child-row](figures/horizontal-arrangement-child-row.png) 145 146- **VerticalAlign.Top**: Child elements are top-aligned vertically. 147 148 ```ts 149 Row({}) { 150 Column() { 151 }.width('20%').height(30).backgroundColor(0xF5DEB3) 152 153 Column() { 154 }.width('20%').height(30).backgroundColor(0xD2B48C) 155 156 Column() { 157 }.width('20%').height(30).backgroundColor(0xF5DEB3) 158 }.width('100%').height(200).alignItems(VerticalAlign.Top).backgroundColor('rgb(242,242,242)') 159 ``` 160 161 ![en-us_image_0000001563060765](figures/en-us_image_0000001563060765.png) 162 163- **VerticalAlign.Center**: Child elements are center-aligned vertically. 164 165 ```ts 166 Row({}) { 167 Column() { 168 }.width('20%').height(30).backgroundColor(0xF5DEB3) 169 170 Column() { 171 }.width('20%').height(30).backgroundColor(0xD2B48C) 172 173 Column() { 174 }.width('20%').height(30).backgroundColor(0xF5DEB3) 175 }.width('100%').height(200).alignItems(VerticalAlign.Center).backgroundColor('rgb(242,242,242)') 176 ``` 177 178 ![en-us_image_0000001562700505](figures/en-us_image_0000001562700505.png) 179 180- **VerticalAlign.Bottom**: Child elements are bottom-aligned vertically. 181 182 ```ts 183 Row({}) { 184 Column() { 185 }.width('20%').height(30).backgroundColor(0xF5DEB3) 186 187 Column() { 188 }.width('20%').height(30).backgroundColor(0xD2B48C) 189 190 Column() { 191 }.width('20%').height(30).backgroundColor(0xF5DEB3) 192 }.width('100%').height(200).alignItems(VerticalAlign.Bottom).backgroundColor('rgb(242,242,242)') 193 ``` 194 195 ![en-us_image_0000001563060781](figures/en-us_image_0000001563060781.png) 196 197 198## Arrangement of Layout Child Elements Along Main Axis 199 200In the layout container, you can use the **justifyContent** attribute to set the arrangement mode of child elements along the main axis. The arrangement may begin from the start point or end point of the main axis, or the space of the main axis can be evenly divided. 201 202 203### In \<Column> Container 204 205 **Figure 7** Arrangement of layout child elements along main axis in the \<Column> container 206 207![vertial-arrangement-child-column](figures/vertial-arrangement-child-column.png) 208 209- **justifyContent(FlexAlign.Start)**: The items are aligned with each other toward the start edge of the container along the main axis. 210 211 ```ts 212 Column({}) { 213 Column() { 214 }.width('80%').height(50).backgroundColor(0xF5DEB3) 215 216 Column() { 217 }.width('80%').height(50).backgroundColor(0xD2B48C) 218 219 Column() { 220 }.width('80%').height(50).backgroundColor(0xF5DEB3) 221 }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Start) 222 ``` 223 224 ![en-us_image_0000001562700501](figures/en-us_image_0000001562700501.png) 225 226- **justifyContent(FlexAlign.Center)**: The elements are aligned with each other toward the center of the container along the main axis. The space between the first component and the main-start is the same as that between the last component and the main-end. 227 228 ```ts 229 Column({}) { 230 Column() { 231 }.width('80%').height(50).backgroundColor(0xF5DEB3) 232 233 Column() { 234 }.width('80%').height(50).backgroundColor(0xD2B48C) 235 236 Column() { 237 }.width('80%').height(50).backgroundColor(0xF5DEB3) 238 }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Center) 239 ``` 240 241 ![en-us_image_0000001562700517](figures/en-us_image_0000001562700517.png) 242 243- **justifyContent(FlexAlign.End)**: The elements are aligned with each other toward the end edge of the container along the main axis. 244 245 ```ts 246 Column({}) { 247 Column() { 248 }.width('80%').height(50).backgroundColor(0xF5DEB3) 249 250 Column() { 251 }.width('80%').height(50).backgroundColor(0xD2B48C) 252 253 Column() { 254 }.width('80%').height(50).backgroundColor(0xF5DEB3) 255 }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.End) 256 ``` 257 258 ![en-us_image_0000001562940585](figures/en-us_image_0000001562940585.png) 259 260- **justifyContent(FlexAlign.Spacebetween)**: The elements are evenly distributed along the main axis. The space between any two adjacent elements is the same. The first element is aligned with the main-start, the last element is aligned with the main-end, and the remaining elements are distributed so that the space between any two adjacent elements is the same. 261 262 ```ts 263 Column({}) { 264 Column() { 265 }.width('80%').height(50).backgroundColor(0xF5DEB3) 266 267 Column() { 268 }.width('80%').height(50).backgroundColor(0xD2B48C) 269 270 Column() { 271 }.width('80%').height(50).backgroundColor(0xF5DEB3) 272 }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceBetween) 273 ``` 274 275 ![en-us_image_0000001511900532](figures/en-us_image_0000001511900532.png) 276 277- **justifyContent(FlexAlign.SpaceAround)**: The elements are evenly distributed along the main axis. The space between any two adjacent elements is the same. The space between the first element and main-start, and that between the last element and cross-main are both half the size of the space between two adjacent elements. 278 279 ```ts 280 Column({}) { 281 Column() { 282 }.width('80%').height(50).backgroundColor(0xF5DEB3) 283 284 Column() { 285 }.width('80%').height(50).backgroundColor(0xD2B48C) 286 287 Column() { 288 }.width('80%').height(50).backgroundColor(0xF5DEB3) 289 }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceAround) 290 ``` 291 292 ![en-us_image_0000001562700525](figures/en-us_image_0000001562700525.png) 293 294- **justifyContent(FlexAlign.SpaceEvenly)**: The elements are evenly distributed along the main axis. The space between the first element and main-start, the space between the last element and main-end, and the space between any two adjacent elements are the same. 295 296 ```ts 297 Column({}) { 298 Column() { 299 }.width('80%').height(50).backgroundColor(0xF5DEB3) 300 301 Column() { 302 }.width('80%').height(50).backgroundColor(0xD2B48C) 303 304 Column() { 305 }.width('80%').height(50).backgroundColor(0xF5DEB3) 306 }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceEvenly) 307 ``` 308 309 ![en-us_image_0000001563060785](figures/en-us_image_0000001563060785.png) 310 311 312### In \<Row> Container 313 314 **Figure 8** Arrangement of layout child elements along main axis in the \<Row> container 315 316![vertial-arrangement-child-row](figures/vertial-arrangement-child-row.png) 317 318- **justifyContent(FlexAlign.Start)**: The items are aligned with each other toward the start edge of the container along the main axis. 319 320 ```ts 321 Row({}) { 322 Column() { 323 }.width('20%').height(30).backgroundColor(0xF5DEB3) 324 325 Column() { 326 }.width('20%').height(30).backgroundColor(0xD2B48C) 327 328 Column() { 329 }.width('20%').height(30).backgroundColor(0xF5DEB3) 330 }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Start) 331 ``` 332 333 ![en-us_image_0000001511421356](figures/en-us_image_0000001511421356.png) 334 335- **justifyContent(FlexAlign.Center)**: The elements are aligned with each other toward the center of the container along the main axis. The space between the first component and the main-start is the same as that between the last component and the main-end. 336 337 ```ts 338 Row({}) { 339 Column() { 340 }.width('20%').height(30).backgroundColor(0xF5DEB3) 341 342 Column() { 343 }.width('20%').height(30).backgroundColor(0xD2B48C) 344 345 Column() { 346 }.width('20%').height(30).backgroundColor(0xF5DEB3) 347 }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Center) 348 ``` 349 350 ![en-us_image_0000001511900516](figures/en-us_image_0000001511900516.png) 351 352- **justifyContent(FlexAlign.End)**: The elements are aligned with each other toward the end edge of the container along the main axis. 353 354 ```ts 355 Row({}) { 356 Column() { 357 }.width('20%').height(30).backgroundColor(0xF5DEB3) 358 359 Column() { 360 }.width('20%').height(30).backgroundColor(0xD2B48C) 361 362 Column() { 363 }.width('20%').height(30).backgroundColor(0xF5DEB3) 364 }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.End) 365 ``` 366 367 ![en-us_image_0000001562940601](figures/en-us_image_0000001562940601.png) 368 369- **justifyContent(FlexAlign.Spacebetween)**: The elements are evenly distributed along the main axis. The space between any two adjacent elements is the same. The first element is aligned with the main-start, the last element is aligned with the main-end, and the remaining elements are distributed so that the space between any two adjacent elements is the same. 370 371 ```ts 372 Row({}) { 373 Column() { 374 }.width('20%').height(30).backgroundColor(0xF5DEB3) 375 376 Column() { 377 }.width('20%').height(30).backgroundColor(0xD2B48C) 378 379 Column() { 380 }.width('20%').height(30).backgroundColor(0xF5DEB3) 381 }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceBetween) 382 ``` 383 384 ![en-us_image_0000001562700521](figures/en-us_image_0000001562700521.png) 385 386- **justifyContent(FlexAlign.SpaceAround)**: The elements are evenly distributed along the main axis. The space between any two adjacent elements is the same. The space between the first element and main-start, and that between the last element and cross-main are both half the size of the space between two adjacent elements. 387 388 ```ts 389 Row({}) { 390 Column() { 391 }.width('20%').height(30).backgroundColor(0xF5DEB3) 392 393 Column() { 394 }.width('20%').height(30).backgroundColor(0xD2B48C) 395 396 Column() { 397 }.width('20%').height(30).backgroundColor(0xF5DEB3) 398 }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceAround) 399 ``` 400 401 ![en-us_image_0000001562820893](figures/en-us_image_0000001562820893.png) 402 403- **justifyContent(FlexAlign.SpaceEvenly)**: The elements are evenly distributed along the main axis. The space between the first element and main-start, the space between the last element and main-end, and the space between any two adjacent elements are the same. 404 405 ```ts 406 Row({}) { 407 Column() { 408 }.width('20%').height(30).backgroundColor(0xF5DEB3) 409 410 Column() { 411 }.width('20%').height(30).backgroundColor(0xD2B48C) 412 413 Column() { 414 }.width('20%').height(30).backgroundColor(0xF5DEB3) 415 }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceEvenly) 416 ``` 417 418 ![en-us_image_0000001511421352](figures/en-us_image_0000001511421352.png) 419 420 421## Adaptive Stretching 422 423In linear layout, adaptive stretching is achieved by using the [\<Blank>](../reference/arkui-ts/ts-basic-components-blank.md) component, which automatically fills the empty spaces in the container – **\<Row>** or **\<Column>** – along the main axis. Just add the width and height as a percentage, and then when the screen width and height change, adaptive stretching takes effect. 424 425 426```ts 427@Entry 428@Component 429struct BlankExample { 430 build() { 431 Column() { 432 Row() { 433 Text('Bluetooth').fontSize(18) 434 Blank() 435 Toggle({ type: ToggleType.Switch, isOn: true }) 436 }.backgroundColor(0xFFFFFF).borderRadius(15).padding({ left: 12 }).width('100%') 437 }.backgroundColor(0xEFEFEF).padding(20).width('100%') 438 } 439} 440``` 441 442 **Figure 9** Portrait mode 443 444![en-us_image_0000001562820881](figures/en-us_image_0000001562820881.png) 445 446 **Figure 10** Landscape mode 447 448![en-us_image_0000001511421332](figures/en-us_image_0000001511421332.png) 449 450 451## Adaptive Scaling 452 453Adaptive scaling means that the size of a child component is automatically adjusted according to a preset ratio to fit into the container across devices of various screen sizes. In linear layout, adaptive scaling can be achieved using either of the following methods: 454 455 456- When the container size is determined, use **layoutWeight** to set the weight of a child component during layout. The container space is then allocated along the main axis among the component and sibling components based on the set layout weight, and the component size setting is ignored. 457 458 ```ts 459 @Entry 460 @Component 461 struct layoutWeightExample { 462 build() { 463 Column() { 464 Text('1:2:3').width('100%') 465 Row() { 466 Column() { 467 Text('layoutWeight(1)') 468 .textAlign(TextAlign.Center) 469 }.layoutWeight(2).backgroundColor(0xF5DEB3).height('100%') 470 471 Column() { 472 Text('layoutWeight(2)') 473 .textAlign(TextAlign.Center) 474 }.layoutWeight(4).backgroundColor(0xD2B48C).height('100%') 475 476 Column() { 477 Text('layoutWeight(6)') 478 .textAlign(TextAlign.Center) 479 }.layoutWeight(6).backgroundColor(0xF5DEB3).height('100%') 480 481 }.backgroundColor(0xffd306).height('30%') 482 483 Text('2:5:3').width('100%') 484 Row() { 485 Column() { 486 Text('layoutWeight(2)') 487 .textAlign(TextAlign.Center) 488 }.layoutWeight(2).backgroundColor(0xF5DEB3).height('100%') 489 490 Column() { 491 Text('layoutWeight(5)') 492 .textAlign(TextAlign.Center) 493 }.layoutWeight(5).backgroundColor(0xD2B48C).height('100%') 494 495 Column() { 496 Text('layoutWeight(3)') 497 .textAlign(TextAlign.Center) 498 }.layoutWeight(3).backgroundColor(0xF5DEB3).height('100%') 499 }.backgroundColor(0xffd306).height('30%') 500 } 501 } 502 } 503 ``` 504 505 **Figure 11** Landscape mode 506 507 ![en-us_image_0000001511421336](figures/en-us_image_0000001511421336.png) 508 509 **Figure 12** Portrait mode 510 511 ![en-us_image_0000001511580968](figures/en-us_image_0000001511580968.png) 512 513- When the container size is determined, set the width of a child component in percentage. The container space is then allocated among the component and sibling components based on the set percentage. 514 515 ```ts 516 @Entry 517 @Component 518 struct WidthExample { 519 build() { 520 Column() { 521 Row() { 522 Column() { 523 Text('left width 20%') 524 .textAlign(TextAlign.Center) 525 }.width('20%').backgroundColor(0xF5DEB3).height('100%') 526 527 Column() { 528 Text('center width 50%') 529 .textAlign(TextAlign.Center) 530 }.width('50%').backgroundColor(0xD2B48C).height('100%') 531 532 Column() { 533 Text('right width 30%') 534 .textAlign(TextAlign.Center) 535 }.width('30%').backgroundColor(0xF5DEB3).height('100%') 536 }.backgroundColor(0xffd306).height('30%') 537 } 538 } 539 } 540 ``` 541 542 **Figure 13** Landscape mode 543 544 ![en-us_image_0000001563060777](figures/en-us_image_0000001563060777.png) 545 546 **Figure 14** Portrait mode 547 548 ![en-us_image_0000001511740564](figures/en-us_image_0000001511740564.png) 549 550 551## Adaptive Extension 552 553Adaptive extension allows users to drag the scrollbar to display the page content outside the screen. It is applicable to the scenario where the content extends beyond the viewport in linear layout. Below are the methods to implement adaptive extension in linear layout: 554 555- [Add a scrollbar to a \<List> component](arkts-layout-development-create-list.md#adding-a-scrollbar): If the list items cannot be fully displayed on one screen, you can place the child elements in different components and employ a scrollbar to display them. Use the **scrollBar** attribute to set the scrollbar status and the **edgeEffect** attribute to set the rebound effect when the scrollbar has reached the edge. 556 557- Use a **\<Scroll>** component: When one screen is not able to accommodate the full content, you can wrap a **\<Scroll>** component at the outer layer of the **\<Column>** or **\<Row>** component to implement. 558 Example of using a **\<Scroll>** component in the vertical layout: 559 560 ```ts 561 @Entry 562 @Component 563 struct ScrollExample { 564 scroller: Scroller = new Scroller(); 565 private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; 566 567 build() { 568 Scroll(this.scroller) { 569 Column() { 570 ForEach(this.arr, (item) => { 571 Text(item.toString()) 572 .width('90%') 573 .height(150) 574 .backgroundColor(0xFFFFFF) 575 .borderRadius(15) 576 .fontSize(16) 577 .textAlign(TextAlign.Center) 578 .margin({ top: 10 }) 579 }, item => item) 580 }.width('100%') 581 } 582 .backgroundColor(0xDCDCDC) 583 .scrollable(ScrollDirection.Vertical) // Vertical scrolling. 584 .scrollBar(BarState.On) // The scrollbar is always displayed. 585 .scrollBarColor(Color.Gray) // The scrollbar color is gray. 586 .scrollBarWidth(10) // The scrollbar width is 10. 587 .edgeEffect(EdgeEffect.Spring) // The spring effect is produced when the scrollbar has reached the edge. 588 } 589 } 590 ``` 591 592 ![en-us_image_0000001511900524](figures/en-us_image_0000001511900524.gif) 593 594 Example of using a **\<Scroll>** component in the horizontal layout: 595 596 597 ```ts 598 @Entry 599 @Component 600 struct ScrollExample { 601 scroller: Scroller = new Scroller(); 602 private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; 603 604 build() { 605 Scroll(this.scroller) { 606 Row() { 607 ForEach(this.arr, (item) => { 608 Text(item.toString()) 609 .height('90%') 610 .width(150) 611 .backgroundColor(0xFFFFFF) 612 .borderRadius(15) 613 .fontSize(16) 614 .textAlign(TextAlign.Center) 615 .margin({ left: 10 }) 616 }) 617 }.height('100%') 618 } 619 .backgroundColor(0xDCDCDC) 620 .scrollable(ScrollDirection.Horizontal) // Horizontal scrolling. 621 .scrollBar(BarState.On) // The scrollbar is always displayed. 622 .scrollBarColor(Color.Gray) // The scrollbar color is gray. 623 .scrollBarWidth(10) // The scrollbar width is 10. 624 .edgeEffect(EdgeEffect.Spring) // The spring effect is produced when the scrollbar has reached the edge. 625 } 626 } 627 ``` 628 629 ![en-us_image_0000001562940609](figures/en-us_image_0000001562940609.gif) 630