Skip to content

Redth/Xamarin.ChromeCustomTabs

Repository files navigation

NOTE: This code is now deprecated since Android Support Library now includes Custom Tabs. You can find the Xamarin bindings and samples in the component: https://components.xamarin.com/view/xamandroidsupportcustomtabs


Xamarin.ChromeCustomTabs

Google just announced the ability to use the Chrome browser's tabs within your own app at Google I/O 2015.

This is currently only available in Chrome for Android version 44 and higher, which as of the time of this document is available as the Chrome Dev app on the Play Store.

Chrome Custom Tabs in Xamarin.Android

Setup

Once you've installed the Chrome Dev app, you need to navigate to chrome://flags and enable Enable Hosted Mode, and restart your browser.

Loading a Page

You can load pages without any customization very easily:

var hostedManager = new HostedActivityManager (this);
var uiBuilder = new HostedUIBuilder ();

hostedManager.LoadUrl ("http://google.com", uiBuilder);

Customization

You can also customize the look and feel of the browser tab. You can change the background colour of the toolbar, customize start and exit animations, add items to the overflow menu, and even add icons to the action bar!

// Xamarin Blue
uiBuilder.SetToolbarColor (Color.Argb (255, 52, 152, 219));

// Customize animations
uiBuilder.SetStartAnimations (this, Resource.Animation.slide_in_right, Resource.Animation.slide_out_left);
uiBuilder.SetExitAnimations (this, Resource.Animation.slide_in_left, Resource.Animation.slide_out_right);

See the sample for more information about adding menu and action bar items.

NuGet

There is a package available on NuGet: http://www.nuget.org/packages/Xamarin.Android.ChromeCustomTabs

There will be a component in the Xamarin Component Store soon with Samples and documentation!

About

How to use Chrome Custom Tabs in your Xamarin.Android apps!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages