For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/lynx-native-api/lynx-view/update-viewport.md.
Lynx
  • 简体中文
  • updateViewport

    客户端更新 LynxView 视图大小。

    语法

    Android

    public void updateViewport(int widthMeasureSpec, int heightMeasureSpec);

    参数说明

    • widthMeasureSpec: 当前 LynxView 宽度。
    • heightMeasureSpec: 当前 LynxView 高度。

    iOS

    - (void)updateViewportWithPreferredLayoutWidth:(CGFloat)preferredLayoutWidth
                             preferredLayoutHeight:(CGFloat)preferredLayoutHeight
                                        needLayout:(BOOL)needLayout;

    参数说明

    • preferredLayoutWidth: 当前 LynxView 宽度。
    • preferredLayoutHeight: 当前 LynxView 高度。
    • needLayout: 是否需要触发布局。

    Desktop (C++)

    Desktop public API 使用 SetFrame(...) 更新视图矩形,屏幕指标则通过独立的 UpdateScreenMetrics(...) 暴露。

    void SetFrame(float x, float y, float width, float height);

    参数说明

    • x: LynxView 的 x 坐标。
    • y: LynxView 的 y 坐标。
    • width: 当前 LynxView 的宽度。
    • height: 当前 LynxView 的高度。

    兼容性

    LCD tables only load in the browser

    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。