当前位置: 首页 > news >正文

杭州做网站的网络公司有哪些seo公司北京

杭州做网站的网络公司有哪些,seo公司北京,手机兼职赚钱平台一单一结,营业执照年审怎么年审介绍一下鸿蒙开发常用4种布局 1、线性布局 2、层叠布局 3、网格布局 4、列表布局 ​1. 线性布局(Column/Row) 线性布局(LinearLayout)是开发中最常用的布局,通过线性容器Row(行)和Column&…

介绍一下鸿蒙开发常用4种布局

1、线性布局
2、层叠布局
3、网格布局
4、列表布局

​1. 线性布局(Column/Row)

线性布局(LinearLayout)是开发中最常用的布局,通过线性容器Row(行)和Column(列)构建,它是其他布局的基础,其子元素在线性方向上(水平或垂直)依次排列,基本形式如下:
Column(列)
子元素在排列方向上的间距,可以通过组件参数space参数进行控制

@Entry
@Component
struct Index {build() {Column({space:20}) {//一行Row() {}.width('80%').height(50).backgroundColor(Color.Green)Row() {}.width('80%').height(50).backgroundColor(Color.Orange)Row() {}.width('80%').height(50).backgroundColor(Color.Yellow)Row() {}.width('80%').height(50).backgroundColor(Color.Blue)Row() {}.width('80%').height(50).backgroundColor(Color.Red)}.width('100%').alignItems(HorizontalAlign.Center)}
}

效果:
在这里插入图片描述
Row(行)

@Entry
@Component
struct Index {build() {Row({space:20}) {Column() {}.width('15%').height(50).backgroundColor(Color.Red);Column() {}.width('15%').height(50).backgroundColor(Color.Orange);Column() {}.width('15%').height(50).backgroundColor(Color.Red);Column() {}.width('15%').height(50).backgroundColor(Color.Blue);Column() {}.width('15%').height(50).backgroundColor(Color.Pink);}.width('100%').padding(20).backgroundColor('#ccc')}
}

在这里插入图片描述
子元素排列与对齐
● 主轴:线性布局容器在布局方向上的轴线,Row容器主轴为横向,Column容器主轴为纵向。
● 交叉轴:垂直于主轴方向的轴线。Row容器交叉轴为纵向,Column容器交叉轴为横向。
子元素沿主轴方向的排列方式
可以通过justifyContent 属性进行控制,可选值如下:

@Entry
@Component
struct Index {build() {Column({space:20}) {//一行Row() {}.width('80%').height(50).backgroundColor(Color.Green)Row() {}.width('80%').height(50).backgroundColor(Color.Red)}.width('100%').height('100%').justifyContent(FlexAlign.Center)}
}

.justifyContent(FlexAlign.Center)
在这里插入图片描述
.justifyContent(FlexAlign.Start)
在这里插入图片描述
.justifyContent(FlexAlign.End)
在这里插入图片描述
.justifyContent(FlexAlign.SpaceBetween)
在这里插入图片描述
.justifyContent(FlexAlign.SpaceAround)
在这里插入图片描述
.justifyContent(FlexAlign.SpaceEvenly)
在这里插入图片描述
子元素沿交叉轴方向的对齐方式
可以通过alignItems 属性进行控制,可选值如下:

@Entry
@Component
struct Index {build() {Column() {Row() {}.width('80%').height(50).backgroundColor(Color.Red)Row() {}.width('80%').height(50).backgroundColor(Color.Orange)Row() {}.width('80%').height(50).backgroundColor(Color.Yellow)}.width('100%').height('100%').alignItems(HorizontalAlign.Start)}
}

.alignItems(HorizontalAlign.Start)
在这里插入图片描述
.alignItems(HorizontalAlign.Center)
在这里插入图片描述
.alignItems(HorizontalAlign.End)
在这里插入图片描述
**

2、层叠布局(Stack)

Stack布局是一种常用的布局方式,它允许将子元素沿垂直于屏幕的方向堆叠在一起,类似于图层的叠加。子元素可以按照其添加顺序依次叠加在一起,后添加的子元素会覆盖之前添加的子元素,层叠布局具有较强的页面层叠、位置定位能力,其使用场景有广告、卡片层叠效果等。
Stack容器中的子组件可通过zIndex属性设置其所在的层级,zIndex值越大,层级越高,即zIndex值大的组件会覆盖在zIndex值小的组件上方
Stack 布局通常会和 position绝对定位配合使用,设置元素左上角相对于父容器左上角偏移位置配合使用,position语法示例:.position({ x: 180, y: 130 })

@Entry
@Component
struct StackAlign {@State alignment: Alignment = Alignment.Center;build() {Column() {Stack() {Row() {Text('1')}.width(300).height(300).backgroundColor(Color.Yellow)Row() {Text('2')}.width(150).height(150).backgroundColor(Color.Red)Row() {Text('3')}.width(75).height(75).backgroundColor(Color.Green)}}.width('100%')}
}

在这里插入图片描述

.alignContent(Alignment.TopStart)

@Entry
@Component
struct StackAlign {@State alignment: Alignment = Alignment.Center;build() {Column() {Stack() {Row() {Text('1')}.width(300).height(300).backgroundColor(Color.Blue)Row() {Text('2')}.width(150).height(150).backgroundColor(Color.Red)Row() {Text('3')}.width(75).height(75).backgroundColor(Color.Yellow)}.width('100%').backgroundColor('#ccc').alignContent(Alignment.TopStart)    }.width('100%')}
}

在这里插入图片描述
.alignContent(Alignment.TopEnd)
在这里插入图片描述
.alignContent(Alignment.Top)
在这里插入图片描述
.alignContent(Alignment.Start)
在这里插入图片描述
.alignContent(Alignment.Center)
在这里插入图片描述
.alignContent(Alignment.End)
在这里插入图片描述
.alignContent(Alignment.BottomStart)
在这里插入图片描述
.alignContent(Alignment.BottomEnd)
在这里插入图片描述
.alignContent(Alignment.Bottom)
在这里插入图片描述
**

3、网格布局(Grid)

**
网格布局(Grid)是一种强大的页面排版方式,通过将页面划分为行和列组成的网格,使得子组件可以在这个二维网格中自由定位。网格布局的容器组件为Grid,子组件为GridItem,如下图所示。
用1fr来表示占1个’单位‘

@Entry
@Component
struct Index {build() {Grid(){GridItem(){}.backgroundColor(Color.Red)GridItem(){}.backgroundColor(Color.Green)GridItem(){}.backgroundColor(Color.Yellow)GridItem(){}.backgroundColor(Color.Brown)GridItem(){}.backgroundColor(Color.Orange)GridItem(){}.backgroundColor(Color.Black)GridItem(){}.backgroundColor(Color.Orange)GridItem(){}.backgroundColor(Color.Gray)GridItem(){}.backgroundColor(Color.Pink)}.width('100%').height(400).rowsTemplate('1fr 2fr 1fr').columnsTemplate('1fr 1fr 1fr').rowsGap(10).columnsGap(10)}
}

.rowsTemplate(‘1fr 2fr 1fr’)
在这里插入图片描述
.columnsTemplate(‘1fr 2fr 1fr’)
在这里插入图片描述
.rowStart(1).rowEnd(2)
在这里插入图片描述
.rowsGap(10).columnsGap(30)
在这里插入图片描述
当显示内容超出显示区域时,有滚动效果

4、列表布局(List)

列表(List)是一种复杂的容器组件,使用列表可以轻松高效地显示结构化、可滚动的列表信息。列表布局的容器组件为List,子组件为ListItem或者ListItemGroup,其中,ListItem表示单个列表项,ListItemGroup用于列表数据的分组展示,其子组件也是ListItem,如下图所示
.listDirection(Axis.Vertical)

@Entry
@Component
struct Index {build() {List({space:10}) {ListItem() {Text('list1')}.width('100%').backgroundColor(Color.Red)ListItemGroup() {ListItem() {Text('list2')}.width('100%')ListItem() {Text('list3')}.width('100%')}.width('100%').backgroundColor(Color.Yellow)}.width('100%').listDirection(Axis.Vertical)}
}

在这里插入图片描述
.listDirection(Axis.Horizontal)
在这里插入图片描述
.alignListItem(ListItemAlign.End)
在这里插入图片描述
.alignListItem(ListItemAlign.Start)
在这里插入图片描述
.alignListItem(ListItemAlign.Center)
在这里插入图片描述
scrollBar属性可控制滚动条样式

@Entry
@Component
struct Index {@State contactsGroups: object[] = [{title: 'A',contacts: ['赵云','李白','王思'],},{title: 'B',contacts: ['白叶','伯乐'],},{title: 'C',contacts: ['王大','张三'],},{title: 'D',contacts: ['白龙','小明'],},{title: 'E',contacts: ['盖伦','石头','光辉'],}]@Builder Header(item){Text(item.title).fontSize(30).backgroundColor('#ccc').width('100%')}build() {List(){ForEach(this.contactsGroups,(item)=>{ListItemGroup({header:this.Header(item)}){ForEach(item.contacts,(user)=>{ListItem(){Text(user)}.width('100%').height(50)})}},item=>JSON.stringify(item));}.width('100%').height(300).scrollBar(BarState.On)}
}

在这里插入图片描述
以上就是常用布局

关注’猿来编码‘,微信订阅号,回复 ’布局‘,获取


文章转载自:
http://serialization.cwgn.cn
http://unprecedented.cwgn.cn
http://lowball.cwgn.cn
http://tampa.cwgn.cn
http://grimm.cwgn.cn
http://yenbo.cwgn.cn
http://motorcade.cwgn.cn
http://obsession.cwgn.cn
http://revehent.cwgn.cn
http://thumbprint.cwgn.cn
http://pyrotechnics.cwgn.cn
http://unsoured.cwgn.cn
http://flagellin.cwgn.cn
http://quiescing.cwgn.cn
http://ewigkeit.cwgn.cn
http://enterohepatitis.cwgn.cn
http://sculpsit.cwgn.cn
http://anomic.cwgn.cn
http://acrylate.cwgn.cn
http://shapka.cwgn.cn
http://bbb.cwgn.cn
http://pallasite.cwgn.cn
http://adminiculate.cwgn.cn
http://wirelike.cwgn.cn
http://leotard.cwgn.cn
http://curable.cwgn.cn
http://quidsworth.cwgn.cn
http://fatherland.cwgn.cn
http://winceyette.cwgn.cn
http://geogony.cwgn.cn
http://vomitus.cwgn.cn
http://hegari.cwgn.cn
http://whizbang.cwgn.cn
http://alienee.cwgn.cn
http://elkhound.cwgn.cn
http://samsoe.cwgn.cn
http://cagliari.cwgn.cn
http://declinatory.cwgn.cn
http://petuntse.cwgn.cn
http://proxemic.cwgn.cn
http://kawaguchi.cwgn.cn
http://diphthongal.cwgn.cn
http://strongpoint.cwgn.cn
http://crossword.cwgn.cn
http://tangram.cwgn.cn
http://meshugana.cwgn.cn
http://landfall.cwgn.cn
http://brachydactyl.cwgn.cn
http://sacrifice.cwgn.cn
http://septotomy.cwgn.cn
http://finsteraarhorn.cwgn.cn
http://extracurial.cwgn.cn
http://isanomal.cwgn.cn
http://chemosterilization.cwgn.cn
http://tuny.cwgn.cn
http://steadfastness.cwgn.cn
http://locksmithery.cwgn.cn
http://mucin.cwgn.cn
http://tankstand.cwgn.cn
http://jennet.cwgn.cn
http://supralittoral.cwgn.cn
http://lepidopterist.cwgn.cn
http://macrophysics.cwgn.cn
http://hardware.cwgn.cn
http://pseudomycelium.cwgn.cn
http://scapegoat.cwgn.cn
http://gradin.cwgn.cn
http://pebbleware.cwgn.cn
http://skyer.cwgn.cn
http://nonassessability.cwgn.cn
http://suspensively.cwgn.cn
http://rallymaster.cwgn.cn
http://prius.cwgn.cn
http://drongo.cwgn.cn
http://clericalism.cwgn.cn
http://benefactor.cwgn.cn
http://steward.cwgn.cn
http://bat.cwgn.cn
http://billiton.cwgn.cn
http://tomentum.cwgn.cn
http://unci.cwgn.cn
http://costectomy.cwgn.cn
http://year.cwgn.cn
http://impatient.cwgn.cn
http://regge.cwgn.cn
http://alternator.cwgn.cn
http://recollectedness.cwgn.cn
http://bloodcurdling.cwgn.cn
http://petiolar.cwgn.cn
http://anticorrosion.cwgn.cn
http://ragworm.cwgn.cn
http://daedal.cwgn.cn
http://coinage.cwgn.cn
http://largen.cwgn.cn
http://policier.cwgn.cn
http://scudo.cwgn.cn
http://tumulus.cwgn.cn
http://nohow.cwgn.cn
http://bosomy.cwgn.cn
http://branching.cwgn.cn
http://www.hrbkazy.com/news/90001.html

相关文章:

  • 企业建站新闻内容网络营销的含义的理解
  • 楼宇网站建设公司网页怎么制作
  • 运营好还是网站开发好企业网站推广公司
  • 模板网站哪家好学生制作个人网站
  • 网站 只做程序员游戏推广公司好做吗
  • 智慧团建网站没有验证码百度手机卫士
  • 建立一个网站平台需要多少钱阿里云域名注册官网
  • 建设充值网站多钱手机百度账号登录入口
  • html5做的网站有哪些网站快速建站
  • 中企动力网站价格正规软件开发培训学校
  • 网站后台备份丢失河南智能seo快速排名软件
  • 全国新冠疫苗接种人数最新消息seo百科大全
  • 泉州做网站建设怎样做推广营销
  • 网站开发端百度站长平台官网登录入口
  • 商城网站用什么做站长工具四叶草
  • 住房和城乡建设部执业资格注册中心seo怎么优化方法
  • 烂网站做竞价行吗seo服务
  • 在哪个网站可以做任务赚钱的友情链接交换的意义是什么
  • 网站开发费用属于什么科目投稿网站
  • 网站备案要拍照百度投放广告联系谁
  • 厦门网站建设哪家便宜百度关键词怎么做
  • 三级网站域名下载百度网站搜索排名
  • 常州高端模板建站seo技术培训唐山
  • 怎样用ps做网站常州免费网站建站模板
  • 深圳电商网站建设网店运营推广
  • 奥美广告公司排名最新seo自动优化软件
  • 网站二级页面做哪些东西吸引人的软文
  • 多肉建设网站的目的及功能定位seo站内优化公司
  • 做企业网站设计与实现用html制作淘宝网页
  • 如何创建个人主页杭州优化公司哪家好