Giter VIP home page Giter VIP logo

bottomnavigationbar's People

Contributors

bebroll avatar danilkurkin1 avatar flanakin avatar patridge avatar pocheshire avatar ugreg avatar veryhumble avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bottomnavigationbar's Issues

onTabSelected called twice after screen rotation

Hello.

I've started optimizing screen rotations in my app and bumped into this issue. On screen rotation "onTabSelected" method is called twice! First time it's the default tab (position 0 in my case), then the tab, selected before screen rotation.

Can you please give me any hints on how to override this behaviour? I want to keep the views i had rather then switching tabs. Thank you.

NavigationBar on the left side instead of at the bottom

Hi

First of all: thanks for your work. :)
We work on a project where we use your bottom navigation bar. This works perfectly on android 6. But on android 7 the bar sticks on the left side instead of the bottom.

Code is absolutly the same.

Activity Layout:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/myCoordinator"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">
    <FrameLayout
        android:id="@+id/main_frame"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_gravity="left|start" />
</android.support.design.widget.CoordinatorLayout>

Activity set navigation bar:

bottomBar = BottomBar.Attach(this, bundle);
                bottomBar.SetItems(Resource.Menu.menu_bottom_bar);
                bottomBar.SetOnMenuTabClickListener(this);

Layout for navigation bar:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:local="http://schemas.android.com/apk/res-auto">
  <item
    android:id="@+id/action_contacts"
    android:icon="@drawable/ic_contacts"
    android:title="Kontakte" />

  <item
    android:id="@+id/action_birthday"
    android:icon="@drawable/ic_cake"
    android:title="Geburtstag" />

  <item
    android:id="@+id/action_profile"
    android:icon="@drawable/ic_account"
    android:title="Profil" />

  <item
    android:id="@+id/action_settings"
    android:icon="@drawable/ic_settings"
    android:title="Einstellungen" />
</menu>

Do you have any idea what's the reason for this and how we can fix this?

Unable to Build Project

Error: This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is packages/Xamarin.Android.Support.Vector.Drawable.23.3.0/build/Xamarin.Android.Support.Vector.Drawable.targets. (BottomNavigationBar)

Tried removing package and reference from project.. nothing worked.

Please help

1.4.0.3 and Xamarin.Forms: Not compatible

1.4.0.3 now requires Android support libraries >= 24.2.1. Unfortunately, Xamarin.Forms only supports 23.3.0 right now. Is the 24.2.1 requirement necessary?

Thanks!

Problem with the solution

I downloaded the solution to see how it works and opened the solution file with VS 2015 and its not building due to error in styles.xml.
It cannot find TextAppearance.AppCompat.Body1
TextAppearance.AppCompat.Body2.

Can anyone point out why this is happening?
It should come from support library right?

Provide properties to set BarBackground and inactive icon color in fixed Mode

Hi,

I'm working on extending the Xamarin.Forms version of Bottombar. I'm struggling to set the Bar background color to black and figred the only way is to call _bottomBar.UseDarkThemeWithAlpha(true); and add a color definition for
bb_darkBackgroundColor in my colors.xml.

Also I found that setting "white" in the colors.xml changes the inactive icons in darcktheme.

I think it would be much more comfortable to expose this color as a property that can be set directly.

What do you think?

Best
Thomas

OnRestoreInstanceState() must not try to deserialize STATE_BADGE_STATES_BUNDLE if no badge state has been saved

When the BottomBar is attached to an Activity which is re-created from saved state, the BottomBar throws an Exception if no badges have been set. This is caused by OnRestoreInstanceState() always deserializing the value of the saved state key STATE_BADGE_STATES_BUNDLE even if the OnSaveInstanceState() method did not save any state for that key.

Steps to reproduce:

  1. Create an Activity which attaches the BottomBar in OnCreate(), passing the saved instance state to the BottomBar
  2. Enable "Kill Activities" in Developer Options on the device
  3. Launch the app
  4. Press the home button to send the app to the background
  5. Open the app from multitasking

The following crash occurs:

System.ArgumentNullException: Value cannot be null. Parameter name: value at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull (System.Object value, System.String parameterName) [0x00003] in <filename unknown>:0 at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <filename unknown>:0 at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <filename unknown>:0 at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value) [0x00000] in <filename unknown>:0 at BottomNavigationBar.BottomBar.OnRestoreInstanceState (Android.OS.Bundle savedInstanceState) [0x00024] in <filename unknown>:0 at BottomNavigationBar.BottomBar.Attach (Android.Views.View view, Android.OS.Bundle savedInstanceState) [0x0000c] in <filename unknown>:0 at BSiBankingXamarin.UI.Droid.NMBottomBarActivity1[TViewModel].ConfigureAndAddBottomBar (Android.OS.Bundle savedInstanceState) [0x00011] in /Users/bb/Development/NEXT/BSiBankingXamarin/BSiBankingXamarin.UI.Droid/Classes/Views/_Base/NMBottomBarActivity.cs:45
at BSiBankingXamarin.UI.Droid.NMBottomBarActivity1[TViewModel].OnPostCreate (Android.OS.Bundle savedInstanceState) [0x0000a] in /Users/bb/Development/NEXT/BSiBankingXamarin/BSiBankingXamarin.UI.Droid/Classes/Views/_Base/NMBottomBarActivity.cs:37 at BSiBankingXamarin.UI.Droid.TabRootView.OnPostCreate (Android.OS.Bundle savedInstanceState) [0x00003] in /Users/bb/Development/NEXT/BSiBankingXamarin/BSiBankingXamarin.UI.Droid/Classes/Views/Activities/TabRootView.cs:63 at Android.App.Activity.n_OnPostCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3340/4e275588/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:3445 at at (wrapper dynamic-method) System.Object:2f4462a7-b3cd-41c6-9f45-a970d74ae1eb (intptr,intptr,intptr)

How to animate when selecting a tab programmatically?

I found this but it's private.

private void selectTabAtPosition(int position, boolean animate) {
        BottomBarTab oldTab = getCurrentTab();
        BottomBarTab newTab = getTabAtPosition(position);

        oldTab.deselect(animate);
        newTab.select(animate);

        updateSelectedTab(position);
        shiftingMagic(oldTab, newTab, animate);
        handleBackgroundColorChange(newTab, false);
    }

Error in debug visual studio: Could not load assembly

hi,
i love your component, but now, after build, my visual studio show this error:

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'BottomBar.XamarinForms, Version=1.0.6133.37691, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
Nome file: 'BottomBar.XamarinForms.dll'
in Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
in Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
in Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) Buragina.Android

any Help

Resources.GetColor obsolete

Since "Resources.GetColor" static method obsolete following method should be used:

"Resources.GetColor(Resource.Color.colorAccent, Theme)"
->
"new Android.Graphics.Color(ContextCompat.GetColor(this, Resource.Color.colorAccent))"

Sorry i couldnt make a pull request. In code can someone change this ?

Badges Problem

Hi Pochehire,
I am facing two problems with badges which I want to highlight here

  1. When I try to set badge from a fragment then the badges circle becomes bit elliptical and it looks the image is stretched, but when I add through the activity in which the bottombar is instantiated(and just below bottom bar is filled with xml) the badge looks like a perfect circle, so why if I set from fragment taking reference of the bottom bar it becomes elliptical?

  2. The badge's circle comes on the top right side of the bottom bar icon, can I make the badge appear on the top left corner( the opposite) ?

Thank you again for the awesome library, I just want to use it in my project and update your README.

Thanks!

How to change tab on bottom navigationbar

public void OnTabSelected(int position)
{
switch (position)
{
case 0:
Toast.MakeText(ApplicationContext, "Tab History!", ToastLength.Short).Show();
break;
case 1:
Intent realtimeIntent = new Intent(this, typeof(RealtimeActivity));
StartActivity(realtimeIntent);
break;
case 2:
Toast.MakeText(ApplicationContext, "Tab Setting!", ToastLength.Short).Show();
break;
}
}

Update refs to v24

It looks like there were some changes with the resources in Nougat 7.0, so if you're targeting Nougat or you have the v24 libraries from Xamarin the build will fail because some resources that are in the BottomNavigationBar do not exists anymore.

I think it's only a thing of updating the referenced Xamarin libraries.
Took me a couple of hours trying to figure what was exactly the problem though.

Translucent NavigationBar is never created since it's method will always return false.

Note: I am using the NuGet Package, but i made the same test at this current code and results the same.
Problem: method NavBarMagic(Activity activity, BottomBar bottomBar) always returns as false because the property bottomBar.DrawBehindNavBar which is declared as false, is never set and can't be set as true making the if clause inside the method always returning, making it impossible to draw behind it.
In-depth Explanation:
In the following if clause, taken from the NuGet code:

if (!bottomBar.DrawBehindNavBar || navBarHeight == 0 ||
                Build.VERSION.SdkInt >= BuildVersionCodes.IceCreamSandwich &&
                ViewConfiguration.Get((Context)activity).HasPermanentMenuKey ||
                Build.VERSION.SdkInt < BuildVersionCodes.JellyBeanMr1 &&
                (softMenuIdentifier <= 0 || !res.GetBoolean(softMenuIdentifier)))
            {
                return;
            }

Or, in the following if clause, taken from this current branch:

if (!bottomBar.DrawBehindNavBar
                || navBarHeight == 0)
            {
                return;
            }

The first property bottomBar.DrawBehindNavBar will always return as false
since it is declared as false and there is no way to set it as true because it is declared as protected. So we end up having this logical case:

if (true || false || true && true || false && (false || false))
{
                return;
}

In which will always results in true, doesn't matter the other cases since true || will always return true.
Solution: Changing access of the property from:
protected bool DrawBehindNavBar { get; set; }
to:
public bool DrawBehindNavBar { get; set; }

MakeBadgeForTabAt() throws a MethodNotFoundException when used on a device with API 22 or lower

The method SetTextAppearance(int resId) used in BottomBarBadge's constructor has only been introduced in API level 23, leading to a MethodNotFoundException when constructing a new instance on a device running API level 22 or lower.

Exception:

Java.Lang.NoSuchMethodError: no method with name='setTextAppearance' signature='(I)V' in class Landroid/widget/TextView; at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/2923/52635947/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at Java.Interop.JniEnvironment+InstanceMethods.GetMethodID (JniObjectReference type, System.String name, System.String signature) [0x00068] in /Users/builder/data/lanes/3340/4e275588/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11240 at Java.Interop.JniType.GetInstanceMethod (System.String name, System.String signature) [0x0000f] in /Users/builder/data/lanes/3340/4e275588/source/Java.Interop/src/Java.Interop/Java.Interop/JniType.cs:228 at Java.Interop.JniPeerMembers+JniInstanceMethods.GetMethodInfo (System.String encodedMember) [0x0003a] in /Users/builder/data/lanes/3340/4e275588/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs:94 at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0004f] in /Users/builder/data/lanes/3340/4e275588/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:30 at Android.Widget.TextView.SetTextAppearance (Int32 resId) [0x00017] in /Users/builder/data/lanes/3340/4e275588/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Widget.TextView.cs:5781 at BottomNavigationBar.BottomBarBadge..ctor (Android.Content.Context context, Int32 position, Color backgroundColor) [0x00045] in <filename unknown>:0 at BottomNavigationBar.BottomBarBadge..ctor (Android.Content.Context context, Int32 position, Android.Views.View tabToAddTo, Color backgroundColor) [0x00000] in <filename unknown>:0 at BottomNavigationBar.BottomBar.MakeBadgeForTabAt (Int32 tabPosition, Color backgroundColor, Int32 initialCount) [0x00074] in <filename unknown>:0 at BSiBankingXamarin.UI.Droid.NMBottomBarActivity1[TViewModel].ConfigureAndAddBottomBar (Android.OS.Bundle savedInstanceState) [0x000cf] in /Users/bb/Development/NEXT/BSiBankingXamarin/BSiBankingXamarin.UI.Droid/Classes/Views/_Base/NMBottomBarActivity.cs:64
at BSiBankingXamarin.UI.Droid.NMBottomBarActivity1[TViewModel].OnPostCreate (Android.OS.Bundle savedInstanceState) [0x0000a] in /Users/bb/Development/NEXT/BSiBankingXamarin/BSiBankingXamarin.UI.Droid/Classes/Views/_Base/NMBottomBarActivity.cs:37 at BSiBankingXamarin.UI.Droid.TabRootView.OnPostCreate (Android.OS.Bundle savedInstanceState) [0x00003] in /Users/bb/Development/NEXT/BSiBankingXamarin/BSiBankingXamarin.UI.Droid/Classes/Views/Activities/TabRootView.cs:63 at Android.App.Activity.n_OnPostCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3340/4e275588/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:3445 at at (wrapper dynamic-method) System.Object:d283efd6-cfaf-4d2a-942a-ca91f57dc5db (intptr,intptr,intptr) at --- End of managed exception stack trace --- at java.lang.NoSuchMethodError: no method with name='setTextAppearance' signature='(I)V' in class Landroid/widget/TextView; at at md50be6f6596e887576060a6837af1be24a.TabRootView.n_onPostCreate(Native Method) at at md50be6f6596e887576060a6837af1be24a.TabRootView.onPostCreate(TabRootView.java:39) at at android.app.Instrumentation.callActivityOnPostCreate(Instrumentation.java:1150) at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2178) at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at at android.app.ActivityThread.access$800(ActivityThread.java:135) at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at at android.os.Handler.dispatchMessage(Handler.java:102) at at android.os.Looper.loop(Looper.java:136) at at android.app.ActivityThread.main(ActivityThread.java:5017) at at java.lang.reflect.Method.invokeNative(Native Method) at at java.lang.reflect.Method.invoke(Method.java:515) at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at at dalvik.system.NativeStart.main(Native Method)

Set the background color

Hi! :)

I tried to set the background color to white, similar to one of the screenshots you have in the repo. But so far it wouldn't work. When I do nothing, it takes my accent color. I found that I can use the dark Theme and set a new dark theme color. But when I set white as a color there, the icons are no longer visible.
How did you achive the design in the screenshot?

Version of dependencies

Hi, as you already know, we're using this component with Xamarin.Forms too.

Suddenly the current stable package of Xamarin.Forms does not support any of the dependencies listed below because it's working on 23.3.0, so we're stuck with v1.1.2. Can we maybe revert the dependencies to the previous versions if it does not break anything?

The current Dependencies (since v1.1.3):

Xamarin.Android.Support.Animated.Vector.Drawable (>= 23.4.0)
Xamarin.Android.Support.Design (>= 23.4.0)
Xamarin.Android.Support.v4 (>= 23.4.0)
Xamarin.Android.Support.v7.AppCompat (>= 23.4.0)
Xamarin.Android.Support.v7.RecyclerView (>= 23.4.0)
Xamarin.Android.Support.Vector.Drawable (>= 23.4.0)

Thanks in advance.

SetItemsFromMenu Obsolete

The example on the project's home page shows using SetItemsFromMenu, but the compiler shows a warning indicating obsolete, deprecated. What is the proper way to set the menu items?

Crash when attempting to set items

Code in OnCreate()

_bottomBar = BottomBar.Attach(this, savedInstanceState);
_bottomBar.SetItems(new BottomBarTab[] { new BottomBarTab(Resource.Mipmap.Icon, "Test") });
_bottomBar.SetOnTabClickListener(this);

Crashes on the second line.

Crash:

Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class <unknown> ---> Android.Views.InflateException: Binary XML file line #1: Error inflating class <unknown> ---> Java.Lang.Reflect.InvocationTargetException:  ---> Java.Lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010059 a=3}
  at --- End of managed Java.Lang.UnsupportedOperationException stack trace ---
  at java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010059 a=3}
  at at android.content.res.TypedArray.getDrawable(TypedArray.java:867)
  at at android.view.View.<init>(View.java:4001)
  at at android.view.ViewGroup.<init>(ViewGroup.java:604)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:115)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:110)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:106)
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:619)
  at at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
  at at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
  at at android.view.View.inflate(View.java:20171)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.n_onCreate(Native Method)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.onCreate(MainActivity.java:30)
  at at android.app.Activity.performCreate(Activity.java:6309)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
  at at android.app.ActivityThread.-wrap11(ActivityThread.java)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
  at at android.os.Handler.dispatchMessage(Handler.java:111)
  at at android.os.Looper.loop(Looper.java:207)
  at at android.app.ActivityThread.main(ActivityThread.java:5728)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
  --- End of inner exception stack trace ---
  at --- End of managed Java.Lang.Reflect.InvocationTargetException stack trace ---
  at java.lang.reflect.InvocationTargetException
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:619)
  at at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
  at at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
  at at android.view.View.inflate(View.java:20171)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.n_onCreate(Native Method)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.onCreate(MainActivity.java:30)
  at at android.app.Activity.performCreate(Activity.java:6309)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
  at at android.app.ActivityThread.-wrap11(ActivityThread.java)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
  at at android.os.Handler.dispatchMessage(Handler.java:111)
  at at android.os.Looper.loop(Looper.java:207)
  at at android.app.ActivityThread.main(ActivityThread.java:5728)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
  at Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010059 a=3}
  at at android.content.res.TypedArray.getDrawable(TypedArray.java:867)
  at at android.view.View.<init>(View.java:4001)
  at at android.view.ViewGroup.<init>(ViewGroup.java:604)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:115)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:110)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:106)
  at ... 24 more
  --- End of inner exception stack trace ---
  at --- End of managed Android.Views.InflateException stack trace ---
  at android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
  at at android.view.LayoutInflater.createView(LayoutInflater.java:645)
  at at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
  at at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
  at at android.view.View.inflate(View.java:20171)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.n_onCreate(Native Method)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.onCreate(MainActivity.java:30)
  at at android.app.Activity.performCreate(Activity.java:6309)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
  at at android.app.ActivityThread.-wrap11(ActivityThread.java)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
  at at android.os.Handler.dispatchMessage(Handler.java:111)
  at at android.os.Looper.loop(Looper.java:207)
  at at android.app.ActivityThread.main(ActivityThread.java:5728)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
  at Caused by: java.lang.reflect.InvocationTargetException
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:619)
  at ... 22 more
  at Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010059 a=3}
  at at android.content.res.TypedArray.getDrawable(TypedArray.java:867)
  at at android.view.View.<init>(View.java:4001)
  at at android.view.ViewGroup.<init>(ViewGroup.java:604)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:115)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:110)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:106)
  at ... 24 more
  --- End of inner exception stack trace ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00082] in /Users/builder/data/lanes/3540/1cf254db/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:12649
  at Java.Interop.JniPeerMembers+JniStaticMethods.InvokeObjectMethod (System.String encodedMember, Java.Interop.JniArgumentValue* parameters) [0x0001b] in /Users/builder/data/lanes/3540/1cf254db/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniStaticMethods.cs:97
  at Android.Views.View.Inflate (Android.Content.Context context, Int32 resource, Android.Views.ViewGroup root) [0x00069] in /Users/builder/data/lanes/3540/1cf254db/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.View.cs:13446
  at BottomNavigationBar.BottomBar.UpdateItems (BottomNavigationBar.BottomBarItemBase[] bottomBarItems) [0x0016e] in <filename unknown>:0
  at BottomNavigationBar.BottomBar.SetItems (BottomNavigationBar.BottomBarTab[] bottomBarTabs) [0x0000d] in <filename unknown>:0
  at PortalsofPrayer.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00049] in /Users/danielbergquist/src/portals/PortalsofPrayer/Droid/MainActivity.cs:36
  at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3540/1cf254db/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:2426
  at at (wrapper dynamic-method) System.Object:55083670-ce0a-4318-b726-d9181396715a (intptr,intptr,intptr)
  at --- End of managed Android.Views.InflateException stack trace ---
  at android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class <unknown>
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
  at at android.view.View.inflate(View.java:20171)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.n_onCreate(Native Method)
  at at md58441721984586c4571cb9a14cde11b83.MainActivity.onCreate(MainActivity.java:30)
  at at android.app.Activity.performCreate(Activity.java:6309)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
  at at android.app.ActivityThread.-wrap11(ActivityThread.java)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
  at at android.os.Handler.dispatchMessage(Handler.java:111)
  at at android.os.Looper.loop(Looper.java:207)
  at at android.app.ActivityThread.main(ActivityThread.java:5728)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
  at Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
  at at android.view.LayoutInflater.createView(LayoutInflater.java:645)
  at at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
  at at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  at ... 17 more
  at Caused by: java.lang.reflect.InvocationTargetException
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:619)
  at ... 22 more
  at Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f010059 a=3}
  at at android.content.res.TypedArray.getDrawable(TypedArray.java:867)
  at at android.view.View.<init>(View.java:4001)
  at at android.view.ViewGroup.<init>(ViewGroup.java:604)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:115)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:110)
  at at android.widget.FrameLayout.<init>(FrameLayout.java:106)
  at ... 24 more

Xamarin info:

Xamarin Studio Community
Version 6.0.2 (build 73)
Installation UUID: 94e8b40a-646a-4c4a-a5f0-23397344dcd2
Runtime:
Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45) (64-bit)
GTK+ 2.24.23 (Raleigh theme)

  Package version: 404020011

Xamarin.Profiler
Not Installed

Apple Developer Tools
Xcode 7.3.1 (10188.1)
Build 7D1014

Xamarin.Mac
Not Installed

Xamarin.Android
Version: 6.1.2.21 (Xamarin Studio Community)
Android SDK: /Users/danielbergquist/Library/Android/sdk
Supported Android versions:
4.0.3 (API level 15)
4.1 (API level 16)
4.4 (API level 19)
5.1 (API level 22)
6.0 (API level 23)

SDK Tools Version: 25.1.7
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.3

Java SDK: /usr
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Xamarin Android Player
Not Installed

Xamarin.iOS
Version: 9.8.2.22 (Xamarin Studio Community)
Hash: f37444a
Branch: cycle7-sr1
Build date: 2016-07-28 12:17:02-0400

Build Information
Release ID: 600020073
Git revision: a6f7a24a9723a2d4f5d33c176615b0d44703ab5b
Build date: 2016-07-26 13:36:15-04
Xamarin addins: f5acb37866a0141bc5ddbe95118f18dae4014568
Build lane: monodevelop-lion-cycle7-sr1

Operating System
Mac OS X 10.11.6
Darwin Daniels-MacBook-Pro-3.local 15.6.0 Darwin Kernel Version 15.6.0
Thu Jun 23 18:25:34 PDT 2016
root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

NuGet:

BottomNavigationBar 1.1.3

Change icon

Is it possible to change the tab icon when selected just like the one from roughike/BottomBar? Thanks

Badge flexability

First of all, thank you for your lib, found it very useful.

Regarding the problem I have - when badge number grows to 100 - number is cut to 10 as drawing is not updated on count change. When restarting the app - 100 fits the drawing the radius is getting bigger as you place the badge in the circle not rectangle with round corners.

I've updated the project to fulfill those requirements and I can commit the changes.
Also I did add the limit to number, so if set to 100, badge will show +99 on growing counter.

Let me know where/how you want them.

Error inflating class

I wanna set the bar up in my app but it gives an exception when it reaches the line _bottomBar.SetItems(Resource.Menu.bottombar_menu);.
The exception is "Android.Views.InflateException: Binary XML file line #1: Error inflating class ".
What may this problem be about?

You are trying to install this package into a project that targets '.NETPortable,Version=v4.5...

Is there a specific version that this targets? The error i'm getting is:

Could not install package 'Xamarin.Android.Support.v4 23.4.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

BottomNavigationBar overrides content of the Layout or Fragment it's attached to.

I have Navigation Drawer in my application, so I run into issue that Bottom Navigation Bar is above the Navigation Drawer. So, following your suggestion:

All you need to do is instead of attaching the BottomBar to your Activity, attach it to the view that has your content. For example, if your fragments are in a ViewGroup that has the id fragmentContainer

So I did just that:

        protected override void OnCreate(Bundle bundle)
        {
            // Some stuff

            bottomBar = BottomBar.Attach(this.FindViewById<FrameLayout>(Resource.Id.fragmentContainer), bundle);
            bottomBar.SetItems(Resource.Menu.bottombar_menu);
            bottomBar.SetOnMenuTabClickListener(this);
            bottomBar.SetGravity(GravityFlags.Bottom);

            var layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
            layoutParams.Gravity = GravityFlags.Bottom;

            bottomBar.LayoutParameters = layoutParams;
            bottomBar.NoTopOffset();

            // Make a Badge for the first tab, with red background color and a value of "13".
            BottomBarBadge unreadMessages = bottomBar.MakeBadgeForTabAt(0, "#FF0000", 13);

            // Control the badge's visibility
            unreadMessages.Show();
            unreadMessages.Hide();

            // Change the displayed count for this badge.
            unreadMessages.Count = 4;

            // Change the show / hide animation duration.
            unreadMessages.AnimationDuration = 200;

            // If you want the badge be shown always after unselecting the tab that contains it.
            unreadMessages.AutoShowAfterUnSelection = true;

            var fragment = this.FragmentManager.BeginTransaction();
            fragment.AddToBackStack(null);
            fragment.Add(Resource.Id.fragmentContainer, new CustomFragment());
            fragment.Commit();
        }

But unfortunately in result the Bottom Navigation Bar is visible, but the content of Fragment is not.

I checked UI Hierarchy, my fragment content is not even added.

I also tried adding just simple LinearLayout under the view I attached Bottom Navigation Bar, it was also overriden by the Bottom Navigation Bar.

Here is my AXML for main activity view:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:minWidth="25px"
    android:minHeight="25px"
    android:fitsSystemWindows="true">
    <android.support.v4.widget.DrawerLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:minWidth="25px"
        android:minHeight="25px"
        android:id="@+id/drawer_layout">
      <RelativeLayout 
            android:layout_width="match_parent"
            android:layout_height="match_parent">
          <include
              layout="@layout/toolbar"
              android:id="@+id/app_bar"/>
        <ScrollView             
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_below="@id/app_bar">
            <FrameLayout
              android:id="@+id/fragmentContainer"
              android:minWidth="25px"
              android:minHeight="25px"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              />        
        </ScrollView>

        </RelativeLayout>
        <android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            app:menu="@menu/nav_menu"
            app:headerLayout="@layout/menu_header" />
    </android.support.v4.widget.DrawerLayout>
</LinearLayout>

Either I am doing something wrong or in some specific combination of views this issue persists.
Looking forward to some explanation why it is happening.

hiding the visibility of bottom bar creates empty space

Hi @pocheshire ,

I am about to finish my development of app and there is one(major) problem which I am facing. The problem goes like this.
In my activity I have set WindowSoftInputMode = SoftInput.AdjustPan and I am using this as my application theme

  <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
  </style>

The thing is I want to hide the bottombar when the keybaord pops -up, so for that I have added a globalListener to my rootlayout and I detect that when keyboard is up I hide thebottombar. I have attached the bottombar to the framelayout of my main.axml.Uptill now I had the above thing set but recently i had noticed that I am not able to scroll the entire view when the softkeyboard is up coz i have set adjustPan so I set it to adjustSize in my activity, Now what is happening is I am getting an empty space above my framelayout which is inside DrawerLayout, when ever I am hiding the bottomBar on keybaord pop-up. I am unable to resolve this issue can you kindly help me with that.

My main.axml looks like this

<RelativeLayout>
    <LinearLayout>
        <AppBarLayout>

              // has toolbar
              //has searchlayout
        </AppBarLayout>
        <DrawerLayout>
            <FrameLayout>
                //BottomBar attached to this framelayout
           </FrameLayout>
           <NavigationView>
             //HamburgerMenuitems
           </NavigationView>
        </DrawerLayout>
    </LinearLayout>
</RelativeLayout>

So my problem is I am not able to figure out why and from where that empty space equal to height of bottombar is coming(presumably) and how do I fix that.

Thanks again for such a great library.

How to switch current page by PCL programmatically (not user touch)?

Hi, I am new.

In the sample, BottomBar can use OnTabSelected ( user touch & trigger ) to switch current page by position.

but, How to switch current page by PCL programmatically (not user touch)?

this is not work...
((TabbedPage)Application.Current.MainPage).CurrentPage = page.Current;

ShadowView not visible when using with Xamarin.Forms

Hi @pocheshire, thanks for a great component.

I am using BottomNavigationBar in my PCL Xamarin.Forms app implementing it via. a renderer.
But the shadow is somehow gone, not visible at all.

Is it possible to customize the shadowView? A gray line instead of a shadow would do the job.

Change background color of Bottom Bar

Hi,
I need my bottom bar to have jet black background with icons given as png images( that are in white ) and when it anyone is selected( the image should change ). I am not sure if we can do that in this library.
But what i Was trying I used the UseDarkTheme() and the bottom bar had dark grey background and the color of my icons changed to grey from transparent(as they are png).
How i Can make my bottom bar background color black and at the same time keep my pngs as it is or change them to white.

Change The Items front colors

Hi,

how its possible to change the text color of the item in the menu?

i try to add the textcolor, but it dosent work, its always gray. idem the icon.

<item android:id="@+id/bb_menu_favorites" android:title="Manage Licenses" android:icon="@drawable/ic_settings" android:textColor="#ff0000"/>

how i can change the color of the text?

thanks.

Bottom Bar tabs come over Keyboard when search view is clicked

Hi,
Since I am using your library and thank you guys for this open source project.
I am facing one more issue.I have used for the time being Bottom navigation in my main activity and I have a searchview in toolbar which comes out when icon is clicked.
The problem is the bottom bar tabs come over the keybaord and the screen size becomes very less.
So what should be the best approach for this.I am not sure if I have to hide the bottom bar or something is their in design guidelines.Any help will be much appreciated.

So the guidelines say,

Bottom sheets, navigation drawers, and keyboards appear in front of the bottom navigation bar, temporarily covering it.

So how do we attain this, can you tell me?
Thank you

Navigating to new fragment, then back to BottomNavigationBar fragment

I have three tabs in my BottomNavigationBar.

Clicking on a tab replaces a FrameLayout with a Fragment.

If I navigate from the Fragment holding the BottomNavigationBar, to a new fragment, then back to the BottomNavigationBar Fragment, the BottomNavigationBar is gone and the Fragment loaded into its Framelayout is also gone.

I have tried attaching the BottomNavigationBar to the Activity and to a view inside the Fragment Layout. In the Fragment, all views disappear and in the Activity, the Bottom Bar remains but the loaded fragment is gone.

Is this a bug/not possible?

Thanks Chris

OnMenuTabReSelected method does not call

Hi Pochehire
OnMenuTabReSelected method not call.

 public class MainActivity : AppCompatActivity, IOnMenuTabClickListener
    {
        private BottomBar bottomBar;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            bottomBar = BottomBar.Attach(this, bundle);

            bottomBar.UseFixedMode();

            bottomBar.SetItems(Resource.Menu.bottombar_menu);
            bottomBar.SetOnMenuTabClickListener(this);
        }
        public void OnMenuTabSelected(int menuItemId)
        {
            //ok
        }
        public void OnMenuTabReSelected(int menuItemId)
        {
            //not call
        }
        protected override void OnSaveInstanceState(Bundle outState)
        {
            base.OnSaveInstanceState(outState);
            bottomBar.OnSaveInstanceState(outState);
        }
    }

BNB goes down in special situation!

I used this link to implement BottomNavigationBar in xamarin forms, I need to have the BottomNavigationBar in all of my pages, in this case I have a problem:

1- If I define MainPage in App as a non-NavigationPage, and all inner pages as NavigationPage, the bottomNavigation goes down and only it’s icons are visible!
Image 1, Image 2
2- If I define MainPage in App as a NavigationPage, and all inner pages as non-NavigationPage I'll not be able to see bottomNavigation in inner pages!
Image 1, Image 2
3- If I define both MainPage and inner pages as NavigationPage, I will have two toolbars in inner pages.

I prefer the first option if it's possible, but I cannot handle that!

Navigation bar does not show when changing tabs from button in fragment

Hi, i am using pocheshire Bottom Navigation tabs for xamarin. I am calling the navigation from activity and every tab is one fragment. Now, when i click some button inside fragment i need to be redirected to some other tab(fragment), for eg. click on button in fragment 1 should bring me to tab(fragment) 3. When i'm handling onClick from fragment i am able to go to the desired fragment but without navigation tabs showing. Could someone explain me how to do this but with navigation tabs showing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.