- Sceneform SDK for Android was open sourced and archived (github.com/google-ar/sceneform-android-sdk) with version 1.16.0.
- This site (developers.google.com/sceneform) serves as the documentation archive for the previous version, Sceneform SDK for Android 1.15.0.
- Do not use version 1.17.0 of the Sceneform Maven artifacts.
- The 1.17.1 Maven artifacts can be used. Other than the version, however, the 1.17.1 artifacts are identical to the 1.15.0 artifacts.
ViewSizer
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Public Methods
public
abstract
Vector3
getSize
(View view)
Calculates the desired size of the view in the Scene
. x
represents the width, and y
represents the height.
Parameters
view |
the view to calculate the size of |
Returns
- a new vector that represents the view's size in the
Scene
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eViewSizer\u003c/code\u003e is an interface used to control the size of a \u003ccode\u003eViewRenderable\u003c/code\u003e within a Sceneform \u003ccode\u003eScene\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIt provides a mechanism to calculate the desired size of an Android \u003ccode\u003eView\u003c/code\u003e in meters for 3D placement.\u003c/p\u003e\n"],["\u003cp\u003eThe final rendered size is influenced by both the \u003ccode\u003eViewSizer\u003c/code\u003e and the \u003ccode\u003eNode\u003c/code\u003e's world scale.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetSize()\u003c/code\u003e is the core method, taking an Android \u003ccode\u003eView\u003c/code\u003e and returning a \u003ccode\u003eVector3\u003c/code\u003e representing its dimensions in the scene.\u003c/p\u003e\n"],["\u003cp\u003eSeveral pre-built implementations exist, like \u003ccode\u003eFixedHeightViewSizer\u003c/code\u003e, \u003ccode\u003eFixedWidthViewSizer\u003c/code\u003e, and \u003ccode\u003eDpToMetersViewSizer\u003c/code\u003e, offering different approaches to sizing.\u003c/p\u003e\n"]]],["The `ViewSizer` interface controls the size of a `ViewRenderable` within a `Scene`. Subclasses like `DpToMetersViewSizer`, `FixedHeightViewSizer`, and `FixedWidthViewSizer` determine size based on density-independent pixels per meter, fixed height, or fixed width in meters, respectively. `getSize(View view)` is the method for calculating the desired size of a view. The final displayed size is adjusted by the `getWorldScale()` of the attached `Node`. The method `getSize` return a vector representing the size in the scene, with x being the width and y the height.\n"],null,["# ViewSizer\n\npublic interface **ViewSizer** \n\n|---|---|---|\n| Known Indirect Subclasses [DpToMetersViewSizer](/sceneform/reference/com/google/ar/sceneform/rendering/DpToMetersViewSizer), [FixedHeightViewSizer](/sceneform/reference/com/google/ar/sceneform/rendering/FixedHeightViewSizer), [FixedWidthViewSizer](/sceneform/reference/com/google/ar/sceneform/rendering/FixedWidthViewSizer) |-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [DpToMetersViewSizer](/sceneform/reference/com/google/ar/sceneform/rendering/DpToMetersViewSizer) | Controls the size of a [ViewRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ViewRenderable) in a [Scene](/sceneform/reference/com/google/ar/sceneform/Scene) by defining how many dp (density-independent pixels) there are per meter. | | [FixedHeightViewSizer](/sceneform/reference/com/google/ar/sceneform/rendering/FixedHeightViewSizer) | Controls the size of a [ViewRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ViewRenderable) in a [Scene](/sceneform/reference/com/google/ar/sceneform/Scene) by defining how tall it should be in meters. | | [FixedWidthViewSizer](/sceneform/reference/com/google/ar/sceneform/rendering/FixedWidthViewSizer) | Controls the size of a [ViewRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ViewRenderable) in a [Scene](/sceneform/reference/com/google/ar/sceneform/Scene) by defining how wide it should be in meters. | |||\n\nInterface for controlling the size of a [ViewRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ViewRenderable) in the [Scene](/sceneform/reference/com/google/ar/sceneform/Scene). The final size that the view is displayed at will be the size\nfrom this [ViewSizer](/sceneform/reference/com/google/ar/sceneform/rendering/ViewSizer) scaled by the [getWorldScale()](/sceneform/reference/com/google/ar/sceneform/Node#getWorldScale()) of\nthe [Node](/sceneform/reference/com/google/ar/sceneform/Node) that the [ViewRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ViewRenderable) is attached to. \n\n### Public Methods\n\n|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) | [getSize](/sceneform/reference/com/google/ar/sceneform/rendering/ViewSizer#getSize(android.view.View))([View](https://developer.android.com/reference/android/view/View) view) Calculates the desired size of the view in the [Scene](/sceneform/reference/com/google/ar/sceneform/Scene). |\n\nPublic Methods\n--------------\n\n#### public abstract [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3)\n**getSize**\n([View](https://developer.android.com/reference/android/view/View) view)\n\nCalculates the desired size of the view in the [Scene](/sceneform/reference/com/google/ar/sceneform/Scene). [x](/sceneform/reference/com/google/ar/sceneform/math/Vector3#x) represents the width, and [y](/sceneform/reference/com/google/ar/sceneform/math/Vector3#y) represents the height. \n\n##### Parameters\n\n| view | the view to calculate the size of |\n|------|-----------------------------------|\n\n##### Returns\n\n- a new vector that represents the view's size in the [Scene](/sceneform/reference/com/google/ar/sceneform/Scene)"]]