当父组件空间不够时,根据空间的大小,优先级高的组件优先显示,优先级低的只在空间足够时才显示?

当父组件空间不够时,根据空间的大小,优先级高的组件优先显示,优先级低的只在空间足够时才显示?


HarmonyOS
2024-07-28 09:15:26
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
jshyb

如下代码:4个Text的优先级分别为4,3,2,1。数字越大,表示优先级越高。如图当父组件只能显示3个组件时,优先级为1的组件隐藏。

Row() {
  Text().width(40)
    .height(40)
    .margin(10)
    .backgroundColor(Color.White)
    .displayPriority(4)
  Text().width(40)
    .height(40)
    .margin(10)
    .backgroundColor(Color.Orange)
    .displayPriority(3)
  Text().width(40)
    .height(40)
    .margin(10)
    .backgroundColor(Color.Red)
    .displayPriority(2)
  Text().width(40)
    .height(40)
    .margin(10)
    .backgroundColor(Color.Blue)
    .displayPriority(1)
}
.justifyContent(FlexAlign.Center)
.width(200)
.height(150)
.backgroundColor(Color.Grey)

分享
微博
QQ
微信
回复
2024-07-28 20:40:26
相关问题
设置Task优先级方法
226浏览 • 1回复 待解决
如何获知TaskPool执行顺序、优先级
484浏览 • 0回复 待解决
HarmonyOS能否支持网络优先级调度?
62浏览 • 1回复 待解决
求大佬告知如何设置Task优先级
1554浏览 • 1回复 待解决
如何设置约束优先级,有人知道吗?
573浏览 • 2回复 待解决
java如何获取手机存储空间大小
6392浏览 • 1回复 待解决
什么是PolarDB空间分析?
3789浏览 • 1回复 待解决
单个文件夹空间统计
568浏览 • 1回复 待解决
精度优先获取定位失败
1407浏览 • 1回复 待解决
获取设备总存储空间和可用存储空间
1634浏览 • 0回复 待解决
PolarDB 如何支持自建表空间
2766浏览 • 1回复 待解决