Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IView

interface IView
Extends com.amazon.apmf.IStandard IView interface defines common behaviour for all the UI components. IView components are the fundamental building blocks of application user interface and defines behaviour common to all components. It handles interactions like key event, pointer event on the component. All other UI components like ITextView, IImageView, IScrollableView are basic sub interfaces of IView that UI Kit provides. All the functions of this class should be called from the UI thread.

Methods

addLifecycleListener()

com.amazon.apmf.ISubscription* addLifecycleListener(IViewLifecycleListener* viewListener)
This method adds view listener and returns a subscription object related to it. This method adds view listener which is responsible to maintain lifecycle of Views.

Parameters

viewListener
IViewLifecycleListener* — Required Pointer to an instance of IViewLifecycleListener.

Returns

com.amazon.apmf.ISubscription* ISubscription object related to the listener

addPointerEventListener()

com.amazon.apmf.ISubscription* addPointerEventListener(IPointerEventListener* pointerEventListener)
This method adds pointer event listener and returns a subscription object related to it. Pointer events are used to track click or touch events on screen.

Parameters

pointerEventListener
IPointerEventListener* — Required Pointer to an instance of IPointerEventListener.

Returns

com.amazon.apmf.ISubscription* ISubscription object related to the listener

addKeyEventListener()

com.amazon.apmf.ISubscription* addKeyEventListener(IKeyEventListener* keyEventListener)
This method adds key event listener and returns a subscription object related to it. Key events are used for tracking hardware button presses on device (keyboard, remote, physical button on device)

Parameters

keyEventListener
IKeyEventListener* — Required Pointer to an instance of IKeyEventListener.

Returns

com.amazon.apmf.ISubscription* ISubscription object related to the listener

addChild()

void addChild(IView* view)
This method adds view as child of current view

Parameters

view
IView* — Required IView object.

addChildAtIndex()

void addChildAtIndex(IView* view, i32 index)
This method adds view at specific index as child of current view

Parameters

view
IView* — Required IView object.
index
i32 — Required index of child view where view should be added

removeChild()

void removeChild(IView* view)
This method removes view from child of current view

Parameters

view
IView* — Required IView object.

removeChildAtIndex()

void removeChildAtIndex(i32 index)
This method removes view at specific index from child of current view

Parameters

index
i32 — Required index of child view which is to be removed

setSize()

void setSize(com.amazon.kepler.uitoolkit.graphics.Size size)
This method sets the size of view

Parameters

size
com.amazon.kepler.uitoolkit.graphics.Size — Required Size of view.

setOffset()

void setOffset(com.amazon.kepler.uitoolkit.graphics.Point point)
This method sets the offset of view relative to top-left corner of parent’s view

Parameters

point
com.amazon.kepler.uitoolkit.graphics.Point — Required Offset of view.

getChildren()

IView*[] getChildren()
Returns an array of the direct child views of this view.

Returns

IView*[] An array containing the direct child views of this view, or an empty array if this view has no children.

getParent()

IView? getParent()
Returns the parent view of this view. Each view must have a single parent except for the root view, which has no parent. This link is set whenever this view is added as a child under any view.

Returns

IView? The return value is optional and might be absent. IView pointer to the parent of this view. It may be null if this view has not been added as a child to any view.

getSize()

com.amazon.kepler.uitoolkit.graphics.Size getSize()
Returns the size of this view.

Returns

com.amazon.kepler.uitoolkit.graphics.Size Size of the view. If the user has not called setSize, the view will inherit size from its parent. The root view will inherit its size from window dimensions.

getOffset()

com.amazon.kepler.uitoolkit.graphics.Point getOffset()
This method returns the offset of view relative to top-left corner of parent’s view.

Returns

com.amazon.kepler.uitoolkit.graphics.Point Point Offset of view. By default the offset will be {0, 0}.

getTestId()

string getTestId()
This method returns the test id set by the user on this view. See also- IView::setTestId.

Returns

string string Test id set by the user. By default this will return empty string.

setTestId()

void setTestId(string id)
This method sets the test id on this view. This sets a property in accessibility information to emit test the id set by the consumer. This can also be used for debugging purposes by the developer.

Parameters

id
string — Required string.

setVisibility()

void setVisibility(ViewVisibility visibility)
Sets the given visibility to the current view.

Parameters

visibility
ViewVisibility — Required ViewVisibility depicting the desired visibility.

getVisibility()

ViewVisibility getVisibility()
This API returns the current visibility of the view. The default visibility of the view will be ViewVisibility::VISIBLE.

Returns

ViewVisibility ViewVisibility.

isAttachedToWindow()

bool isAttachedToWindow()
Returns if the current view is attached to the view tree in the current window.

Returns

bool bool True if the view is attached in the view tree.

getRootView()

IView? getRootView()
Return the root view of the view hierarchy if attached to the view tree, otherwise will return null value.

Returns

IView? The return value is optional and might be absent. IView.

addSizeChangedListener()

com.amazon.apmf.ISubscription* addSizeChangedListener(ISizeChangeListener* sizeChangedListener)
Adds a size change listener whenever the size of the current view is changed.

Parameters

sizeChangedListener
ISizeChangeListener* — Required ISizeChangeListener.

Returns

com.amazon.apmf.ISubscription* ISubscription to cancel (remove) the listener.

getViewDelegate()

IViewDelegate? getViewDelegate()
Returns the view delegate attached to this view during creation. The view delegate can be casted to the custom implementation of the developer.

Returns

IViewDelegate? The return value is optional and might be absent. A valid IViewDelegate if the view is created using IViewModule::makeViewWithDelegate. Otherwise returns null.

addAxisEventListener()

com.amazon.apmf.ISubscription* addAxisEventListener(IAxisEventListener* axisEventListener)
This method adds axis event listener and returns a subscription object related to it. Axis events are used to track axis value for an event.

Parameters

axisEventListener
IAxisEventListener* — Required Pointer to an instance of IAxisEventListener.

Returns

com.amazon.apmf.ISubscription* ISubscription object related to the listener

getWindowEventDispatcher()

IWindowEventDispatcher? getWindowEventDispatcher()
Gets the IWindowEventDispatcher.

Returns

IWindowEventDispatcher? The return value is optional and might be absent. The IWindowEventDispatcher associated with the IUIWindow on which this view is attached to, or nullptr if this view is not currently attached to a window.

setBackgroundColor()

void setBackgroundColor(com.amazon.kepler.uitoolkit.graphics.Color* backgroundColor)
Sets the background color. This function sets the background color. Default background color is Color::Transparent.

Parameters

backgroundColor
com.amazon.kepler.uitoolkit.graphics.Color* — Required The Color struct defining the background color.

getBackgroundColor()

com.amazon.kepler.uitoolkit.graphics.Color getBackgroundColor()
Returns the background color. This function retrieves the background color.

Returns

com.amazon.kepler.uitoolkit.graphics.Color The Color struct defining the background color.

setOpacity()

void setOpacity(float opacity)
Sets the opacity. This function sets the opacity. Opacity can be in the range 0.0 to 1.0, where 0.0 represents totally transparent and 1.0 represents totally opaque. Default opacity is 1.0.

Parameters

opacity
float — Required A float value representing the opacity level (0.0 to 1.0).

getOpacity()

float getOpacity()
Returns the opacity. This function retrieves the opacity.

Returns

float A float value representing the opacity level (0.0 to 1.0).

setShadow()

void setShadow(com.amazon.kepler.uitoolkit.graphics.IShadow* shadow)
Sets the shadow configuration. This function sets the shadow configuration.

Parameters

shadow
com.amazon.kepler.uitoolkit.graphics.IShadow* — Required The IShadow object defining the shadow properties.

getShadow()

com.amazon.kepler.uitoolkit.graphics.IShadow* getShadow()
Returns the shadow configuration. This function retrieves the shadow configuration.

Returns

com.amazon.kepler.uitoolkit.graphics.IShadow* The IShadow object defining the shadow properties.

setTransformationMatrix()

void setTransformationMatrix(com.amazon.kepler.uitoolkit.graphics.AffineMatrix* matrix)
Sets the transformation matrix. This function sets the transformation matrix. The matrix is applied relative to the view’s top-left corner (origin). The AffineMatrix can be used to achieve translate, scale, rotate, and pivot transformations by composing the appropriate matrix values. To apply a transform around a custom pivot point (ox, oy), wrap the transform with a translate/untranslate: finalMatrix = translate(ox, oy) * transform * translate(-ox, -oy). For detailed documentation and examples of how to construct matrices for common transformations (translate, scale, rotate, skew, and their combinations), refer to SkMatrix

Parameters

matrix
com.amazon.kepler.uitoolkit.graphics.AffineMatrix* — Required A AffineMatrix object representing the transformation matrix.

getTransformationMatrix()

com.amazon.kepler.uitoolkit.graphics.AffineMatrix getTransformationMatrix()
Returns the transformation matrix. This function retrieves the transformation matrix.

Returns

com.amazon.kepler.uitoolkit.graphics.AffineMatrix The AffineMatrix object representing the transformation matrix.

setBorderColor()

void setBorderColor(BorderColor* color)
Sets the color for the Border. This method sets the color for the Border. Default border color for all edges is Color::Black.

Parameters

color
BorderColor* — Required The BorderColor struct representing the border color to be set.

getBorderColor()

BorderColor getBorderColor()
Returns the color of the border. This method retrieves the color of the border.

Returns

BorderColor The BorderColor struct representing the border color.

setBorderWidth()

void setBorderWidth(BorderWidth* width)
Sets the width for the Border. This method sets the width for the Border. Default border width for all edges is 0.0.

Parameters

width
BorderWidth* — Required The BorderWidth struct representing the border width to be set.

getBorderWidth()

BorderWidth getBorderWidth()
Returns the width of the border. This method retrieves the width of the border.

Returns

BorderWidth The BorderWidth struct representing the border width.

setBorderRadius()

void setBorderRadius(BorderRadius* radius)
Sets the corner radius for the Border. This method sets the corner radius for the Border. Default border radius for all corners is 0.0.

Parameters

radius
BorderRadius* — Required A BorderRadius struct representing the border radius to be set.

getBorderRadius()

BorderRadius getBorderRadius()
Returns the radius of the border. This method retrieves the radius of the border, which defines the curvature of the border corners.

Returns

BorderRadius A BorderRadius struct representing the border radius.

setBorderStyle()

void setBorderStyle(BorderStyle style)
Sets the style for the Border. This method sets a uniform border style across all edges. Default border style is BorderStyle::SOLID. For per-edge styling, use IView7::setBorderEdgeStyle. This API and IView7::setBorderEdgeStyle both control border style and follow last-write-wins semantics. Calling this method overrides any per-edge styles previously set via IView7::setBorderEdgeStyle. Conversely, a subsequent call to IView7::setBorderEdgeStyle will override the uniform style set by this method.

Parameters

style
BorderStyle — Required The BorderStyle representing the desired style of the border.

getBorderStyle()

BorderStyle getBorderStyle()
Returns the style of the border. This method is not intended to be used when per-edge styles have been set via IView7::setBorderEdgeStyle. In that case, use IView7::getBorderEdgeStyle instead. If called when per-edge styles are set, it returns the top edge’s style.

Returns

BorderStyle A BorderStyle representing the border style.
Last modified on October 29, 2026