stack如何置底
已解决
@Entry
@Component
struct Index {
build() {
Column() {
Column({ space: 10 }) {
Row({ space: 10 }) {
Image($r("app.media.img"))
.width(30)
.aspectRatio(1)
.borderRadius(15)
Row({ space: 8 }) {
Image($r("app.media.sousuo"))
.width(12)
.height(12)
.margin({ left: 12 })
Text("请输入搜索内容")
.fontColor("#79B9B7")
.fontSize(12)
.fontWeight(400)
.lineHeight(12)
}
.width(268)
.height(36)
.borderRadius(19)
.backgroundColor('rgba(255, 255, 255, 0.62)')
.borderWidth(0.5)
.borderColor("#ffffff")
Image($r("app.media.lingdang"))
.width(23.67)
.height(24)
}
Column({ space: 10 }) {
Text("欢迎使用\n" + "慧考帮")
.fontColor("#000000")
.fontSize(36)
.fontWeight(700)
.lineHeight(43)
Text("你好,XXX")
.textAlign(TextAlign.Center)
.fontColor("#000000")
.fontSize(12)
.fontWeight(400)
.lineHeight(12)
.backgroundColor('rgba(247, 255, 3, 1)')
.width(114)
.height(27)
.borderRadius(14)
}
.alignItems(HorizontalAlign.Start)
Column({ space: 8 }) {
Grid() {
GridItem() {
Image($r("app.media.img_1"))
.height(142)
}
.rowStart(0)
.rowEnd(1)
GridItem() {
Stack() {
Image($r("app.media.img_4"))
.height(62)
Column({ space: 6 }) {
Text("学情分析")
.fontColor("#FFFFFF")
.fontSize(16)
.fontWeight(400)
.lineHeight(16)
Text("随时知晓学情")
.fontColor("#FFFFFF")
.fontSize(12)
.fontWeight(300)
.lineHeight(14)
}
.alignItems(HorizontalAlign.Start)
.padding(10)
}
.alignContent(Alignment.Start)
}
GridItem() {
Image($r("app.media.img_3"))
.height(142)
}
.rowStart(1)
.rowEnd(2)
GridItem() {
Stack() {
Image($r("app.media.img_2"))
.height(62)
Column({ space: 6 }) {
Text("发布资源")
.fontColor("#FFFFFF")
.fontSize(16)
.fontWeight(400)
.lineHeight(16)
Text("随时高效共享")
.fontColor("#FFFFFF")
.fontSize(12)
.fontWeight(300)
.lineHeight(14)
}
.alignItems(HorizontalAlign.Start)
.padding(10)
}
.alignContent(Alignment.Start)
}
}
.columnsGap(4)
.rowsGap(6)
.rowsTemplate("1fr 1fr 1fr")
Image($r("app.media.img_5"))
.offset({ x: 2 })
.margin({ top: 8 })
.width(70)
List({ space: 4 }) {
ListItem() {
RelativeContainer() {
Stack() {
Image($r("app.media.img_6"))
.width(42)
.height(15.72)
Text("资源")
.fontColor("#FFFFFF")
.offset({ x: -8 })
.fontSize(10)
.fontWeight(400)
.lineHeight(12)
}
.width("100%")
.alignContent(Alignment.End)
Column({ space: 9 }) {
Text("这里是数据标题")
.fontColor("#333333")
.fontSize(16)
.fontWeight(500)
.lineHeight(19)
Row() {
Stack() {
Image($r("app.media.img_7"))
Row({ space: 10 }) {
Text("解题")
.fontColor("#00DDB4")
.fontSize(12)
.fontWeight(500)
.lineHeight(12)
Text("这里是解题思路这里是...")
.fontColor("#00AE8E")
.fontSize(10)
.fontWeight(400)
.lineHeight(12)
}
.padding(10)
}
.layoutWeight(1)
.alignContent(Alignment.Start)
Image($r("app.media.img_8"))
.width(36)
.height(29)
}
.width("100%")
.height(29)
.justifyContent(FlexAlign.SpaceBetween)
Row() {
Row({ space: 4 }) {
Image($r("app.media.img_9"))
.width(20)
.height(20)
.borderRadius(10)
Text("用户名称")
.fontColor("#ABABAB")
.fontSize(10)
.fontWeight(400)
.lineHeight(10)
}
Text("2025-12-14 14:23:21")
.fontColor("#ABABAB")
.fontSize(10)
.fontWeight(400)
.lineHeight(10)
}
.width("100%")
.justifyContent(FlexAlign.SpaceBetween)
}
.alignItems(HorizontalAlign.Start)
.width("100%")
.height("100%")
.padding(10)
}
}
.height(112)
.borderRadius(12)
.backgroundColor("#ffffff")
ListItem() {
RelativeContainer() {
Stack() {
Image($r("app.media.img_6"))
.width(42)
.height(15.72)
Text("资源")
.fontColor("#FFFFFF")
.offset({ x: -8 })
.fontSize(10)
.fontWeight(400)
.lineHeight(12)
}
.width("100%")
.alignContent(Alignment.End)
Column({ space: 9 }) {
Text("这里是数据标题")
.fontColor("#333333")
.fontSize(16)
.fontWeight(500)
.lineHeight(19)
Row() {
Stack() {
Image($r("app.media.img_7"))
Row({ space: 10 }) {
Text("解题")
.fontColor("#00DDB4")
.fontSize(12)
.fontWeight(500)
.lineHeight(12)
Text("这里是解题思路这里是...")
.fontColor("#00AE8E")
.fontSize(10)
.fontWeight(400)
.lineHeight(12)
}
.padding(10)
}
.layoutWeight(1)
.alignContent(Alignment.Start)
Image($r("app.media.img_8"))
.width(36)
.height(29)
}
.width("100%")
.height(29)
.justifyContent(FlexAlign.SpaceBetween)
Row() {
Row({ space: 4 }) {
Image($r("app.media.img_9"))
.width(20)
.height(20)
.borderRadius(10)
Text("用户名称")
.fontColor("#ABABAB")
.fontSize(10)
.fontWeight(400)
.lineHeight(10)
}
Text("2025-12-14 14:23:21")
.fontColor("#ABABAB")
.fontSize(10)
.fontWeight(400)
.lineHeight(10)
}
.width("100%")
.justifyContent(FlexAlign.SpaceBetween)
}
.alignItems(HorizontalAlign.Start)
.width("100%")
.height("100%")
.padding(10)
}
}
.height(112)
.borderRadius(12)
.backgroundColor("#ffffff")
}
.width("100%")
.height("100%")
}
.alignItems(HorizontalAlign.Start)
.offset({ y: 24 })
.height(221)
.width("100%")
}
.padding(14)
.alignItems(HorizontalAlign.Start)
Stack({ alignContent: Alignment.Bottom }) {
Image($r("app.media.img_10"))
.width("100%")
Row() {
Column({ space: 6 }) {
Image($r("app.media.img_11"))
.width(22)
.height(22)
Text("首页")
.fontColor("#D4D4D4")
.fontSize(11)
.fontWeight(400)
.lineHeight(11)
.textAlign(TextAlign.Center)
}
Column({ space: 6 }) {
Image($r("app.media.img_12"))
.width(22)
.height(22)
Text("社区")
.fontColor("#D4D4D4")
.fontSize(11)
.fontWeight(400)
.lineHeight(11)
.textAlign(TextAlign.Center)
}
Column({ space: 6 }) {
Image($r("app.media.img_13"))
.width(53)
.height(52.49)
}
Column({ space: 6 }) {
Image($r("app.media.img_14"))
.width(22)
.height(22)
Text("试卷")
.fontColor("#D4D4D4")
.fontSize(11)
.fontWeight(400)
.lineHeight(11)
.textAlign(TextAlign.Center)
}
Column({ space: 6 }) {
Image($r("app.media.img_15"))
.width(22)
.height(22)
Text("我的")
.fontColor("#D4D4D4")
.fontSize(11)
.fontWeight(400)
.lineHeight(11)
.textAlign(TextAlign.Center)
}
}
.offset({ y: 24 })
.justifyContent(FlexAlign.SpaceEvenly)
.width("100%")
}
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.width("100%")
.height("100%")
.backgroundColor("#F4FDFA")
.backgroundImage($r("app.media.home_background"))
}
}

3
浏览190 发布于2025-12-15 13:56广东
全部评论
最多点赞
最新发布
最早发布
写回答
所见即所得编辑器, editor1
工具栏
0/50000
新增插入模板功能
一键使用模板,快速填写内容,轻松发帖~
知道了
- 为了保障您的信息安全,请勿上传您的敏感个人信息(如您的密码等信息)和您的敏感资产信息(如关键源代码、签名私钥、调试安装包、业务日志等信息),且您需自行承担由此产生的信息泄露等安全风险。
- 如您发布的内容为转载内容,请注明内容来源。
我要提问题
了解社区公约,与您携手共创和谐专业的开发者社区。









































苏公安网备 32011402010933号