UniWebViewEmbeddedToolbar

Summary

Represents the embedded toolbar in a web view.

You do not create an instance of this class directly. Instead, use the EmbeddedWebView property in UniWebView to get the current embedded toolbar in the web view and interact with it.

The embedded toolbar of a web view expands its width to match the web view's frame width. It is displayed at either top or bottom of the web view, based on the setting received through SetPosition. By default, the toolbar contains a main title, a back button, a forward button and a done button to close the web view. You can use methods in this class to customize the toolbar to match your app's style.

Methods Summary

Sets the position of the embedded toolbar.

Shows the toolbar.

Hides the toolbar.

Sets the text of the done button.

Sets the text of the back button.

Sets the text of the forward button.

Sets the text of toolbar title.

Sets the background color of the toolbar.

Sets the buttons color of the toolbar.

Sets the text color of the toolbar title.

Hides the navigation buttons on the toolbar.

Shows the navigation buttons on the toolbar.

Methods

Sets the position of the embedded toolbar. You can put the toolbar at either top or bottom of your web view.

The default position is Top.

Parameters
  • UniWebViewToolbarPosition position

    The desired position of the toolbar.

Example

// Sets the web view shows the toolbar at the bottom.
webView.EmbeddedToolbar.SetPosition(UniWebViewToolbarPosition.Bottom);
webView.EmbeddedToolbar.Show();

Shows the toolbar.

Example

webView.EmbeddedToolbar.Show();

Hides the toolbar.

Example

webView.EmbeddedToolbar.Hide();

Sets the text of the done button.

The default text is "Done".

Parameters
  • string text

    The desired text to display as the done button.

Example

webView.EmbeddedToolbar.SetDoneButtonText("关闭");

Sets the text of the back button.

The default text is "❮" ("❮").

Parameters
  • string text

    The desired text to display as the back button.

Example

webView.EmbeddedToolbar.SetDoneButtonText("返回");

Sets the text of the forward button.

The default text is "❯" ("❯").

Parameters
  • string text

    The desired text to display as the forward button.

Example

webView.EmbeddedToolbar.SetDoneButtonText("前进");

Sets the text of toolbar title.

The default is empty. The space is limited, setting a long text as title might not fit in the space.

Parameters
  • string text

    The desired text to display as the title in the toolbar.

Example

webView.EmbeddedToolbar.SetDoneButtonText("My Game");

Sets the background color of the toolbar.

Parameters
  • Color color

    The desired color of toolbar's background.

Example

webView.EmbeddedToolbar.SetBackgroundColor(Color.yellow);

Sets the buttons color of the toolbar.

This color affects the back, forward and done button.

Parameters
  • Color color

    The desired color of toolbar's buttons.

Example

webView.EmbeddedToolbar.SetButtonTextColor(Color.red);

Sets the text color of the toolbar title.

Parameters
  • Color color

    The desired color of the toolbar's title.

Example

webView.EmbeddedToolbar.SetTitleTextColor(Color.blue);

Hides the navigation buttons on the toolbar.

When called, the back button and forward button will not be shown. By default, the navigation buttons are shown.

Example

// Do not show the navigation buttons (go back and go forward).
webView.EmbeddedToolbar.HideNavigationButtons();

Shows the navigation buttons on the toolbar.

When called, the back button and forward button will be shown. By default, the navigation buttons are shown.