安卓中的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
浏览
收藏 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;
    }
分享
微博
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无法获取定位信息
12243浏览 • 4回复 待解决
IBinder鸿蒙使用什么API替代?
3840浏览 • 1回复 待解决
TextView转鸿蒙TextView转鸿蒙
6692浏览 • 1回复 待解决
Transformation对应鸿蒙哪个类?
2629浏览 • 1回复 待解决
php几种不同访问数据库方法
1201浏览 • 1回复 待解决
鸿蒙系统是否就是改版
11378浏览 • 2回复 待解决
鸿蒙系统和系统区别有哪些呢?
13721浏览 • 2回复 已解决
onFftDataCapture用什么替代?
2662浏览 • 1回复 待解决