BubbleTabs.Xamarin 1.0.0

BubbleTabs Xamarin

Binding of the library:
BubbleTab

Put some bubble in your tabs and give your apps a supa fresh style !

Icon provided by:
https://thenounproject.com/term/bubbles/32214/

There is a newer version of this package available.
See the version list below for details.
Install-Package BubbleTabs.Xamarin -Version 1.0.0
dotnet add package BubbleTabs.Xamarin --version 1.0.0
<PackageReference Include="BubbleTabs.Xamarin" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BubbleTabs.Xamarin --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Keep in mind that the AppCompatActivity style is mandatory for example:

XML:
Style.xml

<resources>
  <!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
	<!-- Customize your theme here. -->
	<item name="colorPrimary">@color/colorPrimary</item>
	<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
	<item name="colorAccent">@color/colorAccent</item>
  </style>
</resources>

Main.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	xmlns:app="http://schemas.android.com/apk/res-auto"
	android:orientation="vertical">

	<com.github.florent37.bubbletab.BubbleTab
		android:id="@+id/bubbleTab"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:clipToPadding="false"
		android:background="@android:color/white"
		android:elevation="10dp"

		app:bubbleTab_circleColor="@color/colorAccent"
		app:bubbleTab_circleRatio="1.25"
		app:bubbleTab_image2="@drawable/ic_home_white_24dp"
		app:bubbleTab_image1="@drawable/ic_filter_white_24dp"
		app:bubbleTab_image4="@drawable/ic_map"
		/>

	<android.support.v4.view.ViewPager
		android:id="@+id/viewPager"
		android:layout_width="match_parent"
		android:layout_height="match_parent"/>

</LinearLayout>

C#:

public class MainActivity : AppCompatActivity
{
	protected override void OnCreate(Bundle savedInstanceState)
	{
		base.OnCreate(savedInstanceState);

		// Set our view from the "main" layout resource
		SetContentView(Resource.Layout.Main);
		BubbleTab bubbleTab= FindViewById<BubbleTab>(Resource.Id.bubbleTab);
		ViewPager viewPager= FindViewById<ViewPager>(Resource.Id.viewPager);

		viewPager.Adapter = new FakeAdapter(SupportFragmentManager);

		bubbleTab.SetupWithViewPager(viewPager);
	}

	public class FakeAdapter : FragmentStatePagerAdapter
	{
		public FakeAdapter(Android.Support.V4.App.FragmentManager fm) : base(fm)
		{
			Fm = fm;
		}

		public override int Count
		{
			get { return 5; }
		}

		public Android.Support.V4.App.FragmentManager Fm { get; }

		public override Android.Support.V4.App.Fragment GetItem(int position)
		{
			switch (position)
			{
				default:
					return FakeFragment.NewInstance();
			}
		}
	}

	public class FakeFragment : Android.Support.V4.App.Fragment
	{
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			return inflater.Inflate(Resource.Layout.bubbletab_page, container, false);
		}


		public static Android.Support.V4.App.Fragment NewInstance()
		{
			return new FakeFragment();
		}
	}
}

Keep in mind that the AppCompatActivity style is mandatory for example:

XML:
Style.xml

<resources>
  <!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
	<!-- Customize your theme here. -->
	<item name="colorPrimary">@color/colorPrimary</item>
	<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
	<item name="colorAccent">@color/colorAccent</item>
  </style>
</resources>

Main.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	xmlns:app="http://schemas.android.com/apk/res-auto"
	android:orientation="vertical">

	<com.github.florent37.bubbletab.BubbleTab
		android:id="@+id/bubbleTab"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:clipToPadding="false"
		android:background="@android:color/white"
		android:elevation="10dp"

		app:bubbleTab_circleColor="@color/colorAccent"
		app:bubbleTab_circleRatio="1.25"
		app:bubbleTab_image2="@drawable/ic_home_white_24dp"
		app:bubbleTab_image1="@drawable/ic_filter_white_24dp"
		app:bubbleTab_image4="@drawable/ic_map"
		/>

	<android.support.v4.view.ViewPager
		android:id="@+id/viewPager"
		android:layout_width="match_parent"
		android:layout_height="match_parent"/>

</LinearLayout>

C#:

public class MainActivity : AppCompatActivity
{
	protected override void OnCreate(Bundle savedInstanceState)
	{
		base.OnCreate(savedInstanceState);

		// Set our view from the "main" layout resource
		SetContentView(Resource.Layout.Main);
		BubbleTab bubbleTab= FindViewById<BubbleTab>(Resource.Id.bubbleTab);
		ViewPager viewPager= FindViewById<ViewPager>(Resource.Id.viewPager);

		viewPager.Adapter = new FakeAdapter(SupportFragmentManager);

		bubbleTab.SetupWithViewPager(viewPager);
	}

	public class FakeAdapter : FragmentStatePagerAdapter
	{
		public FakeAdapter(Android.Support.V4.App.FragmentManager fm) : base(fm)
		{
			Fm = fm;
		}

		public override int Count
		{
			get { return 5; }
		}

		public Android.Support.V4.App.FragmentManager Fm { get; }

		public override Android.Support.V4.App.Fragment GetItem(int position)
		{
			switch (position)
			{
				default:
					return FakeFragment.NewInstance();
			}
		}
	}

	public class FakeFragment : Android.Support.V4.App.Fragment
	{
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			return inflater.Inflate(Resource.Layout.bubbletab_page, container, false);
		}


		public static Android.Support.V4.App.Fragment NewInstance()
		{
			return new FakeFragment();
		}
	}
}

Dependencies

This package has no dependencies.

Version History

Version Downloads Last updated
1.0.2 37 7/3/2019
1.0.0 295 11/15/2017