HarmonyOS text可以在不计算宽高快速定位到右下角吗?

Stack({ alignContent: Alignment.Center }) {  
  Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3)  
  Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac)  
}.width('100%').height(150)

这个组件的第二个text可以在不计算宽高快速定位到右下角吗?

HarmonyOS
5天前
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
FengTianYa

请参考以下demo:

@Entry  
@Component  
struct Index {  
  build() {  
    Scroll() {  
      Column() {  
        //Alignment.BottomEnd将第二个text定位到底部尾端  
        Stack({ alignContent: Alignment.BottomEnd }) {  
          Text('First child, show in bottom')  
            .width('90%')  
            .height('100%')  
            .backgroundColor(0xd2cab3)  
          Text('Second child, show in top')  
            .width('70%')  
            .height('60%')  
            .backgroundColor(0xc1cbac)//text组件内容定位到底部尾端  
            .textAlign(TextAlign.End)  
            .align(Alignment.BottomEnd)  
        }.width('100%').height(150)  
      }  
    }  
    .width('100%')  
  }  
}
分享
微博
QQ
微信
回复
5天前
相关问题
怎么让text文本排在image里面的右下角
473浏览 • 1回复 待解决
HarmonyOS photoAsset获取图片失败
141浏览 • 1回复 待解决
如何获取屏幕,你知道
2140浏览 • 1回复 待解决
如何获取图片的,你知道
1880浏览 • 1回复 待解决
获取Column最终的
193浏览 • 1回复 待解决
HarmonyOS获取相册视频的问题
185浏览 • 1回复 待解决
如何测量获取控件
548浏览 • 1回复 待解决
HarmonyOS中的window怎么设置固定
1579浏览 • 1回复 待解决
HarmonyOS如何获取指定子组件的
552浏览 • 1回复 待解决
如何获取窗口的信息
2034浏览 • 1回复 待解决
ArkTs如何获取组件的
4308浏览 • 1回复 待解决