安卓中的FrameLayout.onLayout在鸿蒙中的替换方法

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {

  super.onLayout(changed, left, top, right, bottom);
}

鸿蒙
安卓
HarmonyOS
2021-10-11 11:12:44
6581浏览
收藏 0
回答 2
回答 2
按赞同
/
按时间
Oisnull
2

对应的是onArrange

你需要 implements ComponentContainer.ArrangeListener and setArrangeListener(this);

@Override
    public boolean onArrange(int left, int top, int width, int height) {
        for (int i = 0; i < getChildCount(); i++) {
            int cleft = i % columnCount * childSize;
            int ctop = i / columnCount * childSize;
            getComponentAt(i).arrange(cleft, ctop, childSize, childSize);
        }
        return true;
    }
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
分享
微博
QQ
微信
回复
2021-10-11 16:41:41
左四
1

目前没有替代FrameLayout.onLayout的方法,具体可参考常用布局开发指导:

https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ui-java-layout-directionallayout-0000001050769565

分享
微博
QQ
微信
回复
2021-10-11 15:51:04
相关问题
app鸿蒙2.0无法获取定位信息
15880浏览 • 4回复 待解决
TextView转鸿蒙TextView转鸿蒙
9553浏览 • 1回复 待解决
IBinder鸿蒙使用什么API替代?
6681浏览 • 1回复 待解决
Transformation对应鸿蒙哪个类?
5165浏览 • 1回复 待解决
鸿蒙API映射问题
1558浏览 • 1回复 待解决
鸿蒙ndk和ndk区别大吗
331浏览 • 0回复 待解决
arkts类似clippadding属性
2855浏览 • 1回复 待解决
onFftDataCapture用什么替代?
5418浏览 • 1回复 待解决
鸿蒙开发容易吗?
335浏览 • 1回复 待解决
鸿蒙系统是否就是改版
14685浏览 • 2回复 待解决
鸿蒙系统和系统区别有哪些呢?
16695浏览 • 2回复 已解决
混入鸿蒙jar后,启动失败
7210浏览 • 1回复 待解决