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
- Kotlin
- Java
val context: Context = someValue
val view: PortalView = PortalView(context)
Context context = someValue;
PortalView view = new PortalView(context);
Additionally, you can pass in an AttributeSet and Int
as you can in a FrameLayout
- Kotlin
- Java
val context: Context = someValue
val attrs: AttributeSet = someAttributeSet
val defStyleAttr: Int = someDefStyleAttr
val fragment: PortalView = PortalView(context, attrs, defStyleAttr)
Context context = someValue;
AttributeSet attrs = someAttributeSet;
int defStyleAttr = someDefStyleAttr
PortalView view = new PortalView(context, attrs, defStyleAttr)
Parameters
Name | Type | Description |
---|---|---|
context | Context | The Context for this view. Cannot be null . |
attrs (optional) | AttributeSet | The AttributeSet for this view. Optional parameter. Can be null . |
defStyleAttr (optional) | Int | The default style attribute. Optional parameter. Can be null . |
Methods
getPortalFragment
Gets the attached PortalFragment instance.
Usage
- Kotlin
- Java
val view: PortalView = PortalView(context)
val fragment: PortalFragment? = view.getPortalFragment()
PortalView view = new PortalView(context);
PortalFragment fragment = view.getPortalFragment();
Returns: PortalFragment
setDrawDisappearingViewsLast
Used to indicate the container should change the default drawing order.
Usage
- Kotlin
- Java
val view: PortalView = PortalView(context)
view.setDrawDisappearingViewsLast(true)
PortalView view = new PortalView(context);
view.setDrawDisappearingViewsLast(true);
Parameters
Name | Type | Description |
---|---|---|
drawDisappearingViewsFirst | Boolean | Used to indicate the container should change the default drawing order. |