Skip to main content

PortalView

The PortalView class is an Android FrameLayout that you can use to easily build a View via XML for a Portal. While you can show a Portal to a user using the PortalView class directly, it is recommended to use this via XML. If you need to programmtically create a view, you should use PortalFragment if you can.

You can use PortalView like any other View class. Below is an example of using XML to load the Portal with the ID of "help".

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">

<io.ionic.portals.PortalView
app:portalId="help"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

Because PortalView is an extended FrameLayout class, there are additional functions you not listed below. Refer to the Android documentation on FrameLayout for more information

Constructors

constructor

Usage

val context: Context = someValue
val view: PortalView = PortalView(context)

Additionally, you can pass in an AttributeSet and Int as you can in a FrameLayout

val context: Context = someValue
val attrs: AttributeSet = someAttributeSet
val defStyleAttr: Int = someDefStyleAttr
val fragment: PortalView = PortalView(context, attrs, defStyleAttr)

Parameters

NameTypeDescription
contextContextThe Context for this view. Cannot be null.
attrs (optional)AttributeSetThe AttributeSet for this view. Optional parameter. Can be null.
defStyleAttr (optional)IntThe default style attribute. Optional parameter. Can be null.

Methods

getPortalFragment

Gets the attached PortalFragment instance.

Usage

val view: PortalView = PortalView(context)
val fragment: PortalFragment? = view.getPortalFragment()

Returns: PortalFragment

setDrawDisappearingViewsLast

Used to indicate the container should change the default drawing order.

Usage

val view: PortalView = PortalView(context)
view.setDrawDisappearingViewsLast(true)

Parameters

NameTypeDescription
drawDisappearingViewsFirstBooleanUsed to indicate the container should change the default drawing order.