折りたたみ型フレーム レイアウト

重要

この記事では、パブリック プレビュー段階であり、一般公開前に大幅に変更される可能性がある機能とガイダンスについて説明します。 本書に記載された情報について、Microsoft は明示または黙示を問わずいかなる保証をするものでもありません。

重要

このビューのコンテンツは、アクティビティ ルート ビューがウィンドウにアタッチされた後にのみ使用できます。 これは、実装がウィンドウ マネージャー ライブラリに基づいており、ウィンドウ マネージャーは、ビューがウィンドウにアタッチされている場合にのみ動作しているため発生します。

FoldableFrameLayout では、折りたたみ型デバイスでアプリケーションが実行されている場合に Android のビューを折り返し、別々にレンダリングできる FrameLayout です。

foldableDisplayPosition - 子を調整する方法を指定する値を返すか設定します。 次の 3 つの値のいずれかを指定できます。

  • DisplayPosition.START - 子は開始位置にレンダリングされます。
  • DisplayPosition.END - 子は終了位置にレンダリングされます。
  • DisplayPosition.DUAL - 両方の画面にまたがります (ヒンジの下に表示される場合があります)。

START: tabs on the first screen

DisplayPosition.START

END: tabs on the first screen

DisplayPosition.END

DUAL: tabs on the first screen

DisplayPosition.DUAL

ビューの動作を変更する方法

foldableFrameLayout.foldableDisplayPosition = DisplayPosition.START

app:display_position 属性を tool:tools_application_mode と一緒に使用しても、同じ動作になります。

<com.microsoft.device.dualscreen.layouts.FoldableFrameLayout
    android:id="@+id/duo_wrapper"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:display_position="start"
    tool:tools_application_mode="dual_screen">
    ...
</com.microsoft.device.dualscreen.layouts.FoldableFrameLayout>