Node v6
Starting with v0.19 Astro must be used with Node v6+!
Menu

Anchored Layout Plugin

The Anchored Layout plugin allows you to create simple layouts that consist of a main content view and optional views that can be anchored to the top or bottom.

Anchored Layout is limited to adding views vertically - there is currently no support for adding views horizontally. If this is a feature you'd like, please let us know in our Astro Community Slack!

Sample Usage

const mainWebView = await WebViewPlugin.init()
const bottomWebView = await WebViewPlugin.init()
const layout = await AnchoredLayoutPlugin.init()

mainWebView.navigate('http://icanhas.cheezburger.com')
bottomWebView.navigate('http://www2.warnerbros.com/spacejam/movie/jam.htm')

layout.setContentView(mainWebView)
layout.addBottomView(bottomWebView, { height: 256 })
Application.setMainViewPlugin(layout)

Methods

AnchoredLayoutPlugin.init(options) #

Creates and returns an instance of the anchored layout plugin that is used to make subsequent method calls.

Note: In Android, an empty view is set as the anchored layout's content view on initialization as a placeholder.


setContentView(plugin) #

Sets a plugin's view as the layout's main content view.


addTopView(plugin, options) #

Anchors a plugin's view to the top of the layout. You should use this without the height option if the view you're anchoring has a natural height, otherwise you should explicitly specify the height of the anchored view with the height option.


addBottomView(plugin, options) #

Anchors a plugin's view to the bottom of the layout. You should use this without the height option if the view you're anchoring has a natural height, otherwise you should explicitly specify the height of the anchored view with the height option.


showView(plugin, options) #

Shows the given plugin's view. Note that you must have previously added the plugin to this layout's top or bottom bar using addTopView or addBottomView.


hideView(plugin, options) #

Hides the given plugin's view. Note that you must have previously added the plugin to this layout's top or bottom bar using addTopView or addBottomView.


toggleView(plugin, options) #

Toggles visibility of the given plugin's view (by delegating to showView() and hideView()). Note that you must have previously added the plugin to this layout's top or bottom bar using addTopView() or addBottomView().


showTopViews(options) #

Shows the top anchored plugins.


hideTopViews(options) #

Hides the top anchored plugins.


showBottomViews(options) #

Shows the bottom anchored plugins.


hideBottomViews(options) #

Hides the bottom anchored plugins.


showAll(options) #

Show the top and bottom anchored plugins.


hideAll(options) #

Hides the top and bottom anchored plugins.


clearContentView() #

Clears the layout's main content view. This only removes the view from the layout's view hierarchy and does not destroy it.


clearTopViews(options) #

Clears the top anchored views from the layout. This only removes the views from the layout's view hierarchy and does not destroy them.


clearBottomViews(options) #

Clears the bottom anchored views from the layout. This only removes the views from the layout's view hierarchy and does not destroy them.