roughike / bottombar Goto Github PK
View Code? Open in Web Editor NEW(Deprecated) A custom view component that mimics the new Material Design Bottom Navigation pattern.
License: Apache License 2.0
(Deprecated) A custom view component that mimics the new Material Design Bottom Navigation pattern.
License: Apache License 2.0
How use it in activity_main.xml file rather than in MainActivity.java?
Can we change bottom bar size ?
The issue https://github.com/roughike/BottomBar/issues/24 still occurs with version 1.0.9~1.1.1, only 1.0.7 and 1.0.8 works well.
When using mBottomBar.noTopOffset() with version 1.1.1, the position of top toolbar isn't right, just as below.
Hi, guys.
Can this library used on the left
of the Tablets?
using 1.0.1, my app runs well, except the ugly top border.
after switch to 1.0.3, and add the statement:mBottomBar.hideShadow(), just like below:
mBottomBar = BottomBar.attach(this, savedInstanceState); mBottomBar.hideShadow(); mBottomBar.setItemsFromMenu(R.menu.menu_bottombar, new OnMenuTabSelectedListener() { @Override public void onMenuItemSelected(int resId) { switch (resId) { case R.id.bottomBarHome: displayView(0); break;
the ugly top border appear above the toolbar:
before:
after:
next, when click the bottom icon, error occurs:
the code have been posted in the issue:
How to style top border? #3
not found in sample
Hi, that's mentioned earlier in other issues, but i open a new one just to discuss it.
Material design specs doesn't cover the light with light problem:
It will be great if we can set a color for the BottomBar at anytime, and also will be cool to have a custom attribute to set it via theme.
If you want i can open a PR for it
mBottomBar.noTopOffset() cannot find
Is it possible to change the typeface of the labels by a function like bottomBar.setTypeface(Typeface tf) ?
I using the latest version of library, but every time when I launch app on device with android 5+ I have a gap like on screen:
http://snag.gy/ugDqX.jpg
On device with Android 4.4 everything is fine:
http://snag.gy/yDSf3.jpg
java.lang.NoSuchMethodError: android.widget.FrameLayout.
at com.roughike.bottombar.BottomBar.(BottomBar.java:86)
at com.roughike.bottombar.BottomBar.(BottomBar.java:72)
at com.roughike.bottombar.BottomBar.attach(BottomBar.java:131)
at com.example.bottombar.sample.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:4470)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
at android.app.ActivityThread.access$600(ActivityThread.java:128)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
After calling SelectTabAtLocation I am unable to select card manually. However another SelectTabAtLocation change location normally.
ver1.0.5
i did not set "mapColorForTab()" method.
(mColorMap is null)
java.lang.NullPointerException
at com.roughike.bottombar.BottomBar.handleBackgroundColorChange(BottomBar.java:545)
at com.roughike.bottombar.BottomBar.selectTab(BottomBar.java:530)
at com.roughike.bottombar.BottomBar.onClick(BottomBar.java:366)
at android.view.View.performClick(View.java:4492)
at android.view.View$PerformClick.run(View.java:18647)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
thank you.
I'm running Cyanogenmod 12 (Android 5.1.1) on my OnePlus One and I when I went for a trial run I noticed that the library always detects the software navbar as being active. It's possible to enable it and use it instead of the hardware buttons on the device, but by default it's not active.
It might be worth noting that I have configured my hardware menu button as recent apps but as far as I've noticed no changes when I configure it as menu button.
screenshot_2016-03-20-15-51-48
screenshot_2016-03-20-15-52-00
In Can it handle my Fragments and replace them automagically when a different tab is selected?, codes are:
mBottomBar.setFragmentItems(getSupportFragmentManager(), R.id.fragmentContainer,
new BottomBarFragment(SampleFragment.newInstance("Content for recents."), R.drawable.ic_recents, "Recents"),
new BottomBarFragment(SampleFragment.newInstance("Content for favorites."), R.drawable.ic_favorites, "Favorites"),
new BottomBarFragment(SampleFragment.newInstance("Content for nearby stuff."), R.drawable.ic_nearby, "Nearby")
);
But in Separate BottomBars for individual Fragments, they are:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.my_fragment_layout, container, false);
// initialize your views here
BottomBar bottomBar = BottomBar.attach(view, savedInstanceState);
bottomBar.setItems(
new BottomBarTab(R.drawable.ic_recents, "Recents"),
new BottomBarTab(R.drawable.ic_favorites, "Favorites"),
new BottomBarTab(R.drawable.ic_nearby, "Nearby")
);
// Important! Don't return the view here. Instead, return the bottomBar, as it already contains your view.
return bottomBar;
}
So if I wanna use Bottom bars connected with 4 different fragments, what should I use?
BTW, you guys are really fast for this repository.
The tablet side bar seems to always be white, even changing the new color normally doesn't work. Is this intentional?
Hi,
First nice job doing this library, but there are few things I would change.
If I have so time this weekend I maybe fork it and make some pull request.
Br,
Marcel
Anything known?
The spec sheet recommend using this kind of animation.
Would be awesome if you could implement it.
Thanks for your work BTW, it's a great lib.
Not sure if it's just me.. but I have 5 menu items.. I can't seem to get back to home (0).
I can click and go through all the others fine but clicking home doesn't work. except on the one activity which I have: mBottomBar.selectTabAtPosition(2, false); set in the onResume.. and that ONLY works if I go to menu item 2 then 3, hit return, and then click on 0.
If I click on item 2, then back to home it doesn't work.
Hello, just started checking this out and it seems really cool. However I can't seem to find out how to set the background color or item selected color? Thanks and continue the great work!
Why the licenses are inside of the folders of the library? It would be better to use one file in the root of the library.
I want to get this result.
Here is my current code:
bottomBar = BottomBar.attach(this, savedInstanceState);
bottomBar.setItemsFromMenu(R.menu.bar, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int resId) {
}
});
bottomBar.mapColorForTab(0, ContextCompat.getColor(this, R.color.primary_dark));
bottomBar.mapColorForTab(1, ContextCompat.getColor(this, R.color.md_teal_600));
bottomBar.mapColorForTab(2, ContextCompat.getColor(this, R.color.md_red_500));
bottomBar.mapColorForTab(3, ContextCompat.getColor(this, R.color.md_blue_grey_500));
But the result of this code is a black navbar.
What am I missing?
A library shouldn't declare unnecessary attributes on the Application
as doing so will automatically merge them into app's manifest. For example, an app that doesn't declare supportsRtl
will now have it set to true after importing this library, even though the default value should be false.
BottomBar/bottom-bar/src/main/AndroidManifest.xml
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">
</application>
If no detect whether android device have soft navigation bar or not then the height of bottom bar will abnormal.
Modification:
BottomBar.java
navBarMagic() {
...
boolean hasMenuKey = ViewConfiguration.get(activity).hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
final int navBarHeight;
if(!hasMenuKey && !hasBackKey) {
if (navBarIdentifier > 0) {
navBarHeight = res.getDimensionPixelSize(navBarIdentifier);
} else {
navBarHeight = MiscUtils.dpToPixel(activity, 48);
}
} else {
navBarHeight = 0;
}
...
}
I'm using your BottomBar with another good lib to generate icons : Android Iconics. Its implementation is so easy, you can maybe refer a link into the readme for people who want ? Or don't knoa about that lib ?
https://github.com/mikepenz/Android-Iconics
quick showcase :
bottomBar = BottomBar.attach(view, savedInstanceState);
bottomBar.setFragmentItems(getActivity().getSupportFragmentManager(), R.id.container,
new BottomBarFragment(new LatestKitFragment(), new IconicsDrawable(getActivity(), CommunityMaterial.Icon.cmd_trending_up).sizeDp(18), "Trending"),
new BottomBarFragment(new LatestKitFragment(), new IconicsDrawable(getActivity(), CommunityMaterial.Icon.cmd_newspaper).sizeDp(18), "Latest"),
new BottomBarFragment(new LatestKitFragment(), new IconicsDrawable(getActivity(), CommunityMaterial.Icon.cmd_tag_faces).sizeDp(18), "All")
);
There is a useful medium article how to hide the bottom bar when scrolling down. Maybe you can implement this feature to this library. https://medium.com/@nullthemall/bottom-navigation-behavior-388b9b206667#.7ufpfhq3a
When I use 3 items or less I can't seem to be able to change each item color, it's being set to my primary color automatically which in my case doesn't fit.
17:58:20.335 8390-8390/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.bottombar.sample, PID: 8390
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.view.ViewGroup.getContext()' on a null object reference
at com.example.bottombar.sample.SampleFragment.onCreateView(SampleFragment.java:50)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1067)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1252)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1617)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:517)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5477)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:947)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:742)
03-18 17:58:20.335 2825-3406/? W/ActivityManager: Force finishing activity 1 com.example.bottombar.sample/.MainActivity
Should probably be auto adjusted to "dark style" if the app is using night mode.
It would be awesome if this library also work with Fragments and Fragmentmanager. Some people like me don't use support fragments.
missing drawable
Hi. Thank you for your amazing lib!
I have a few questions, answer on which I didn't find at documentation.
I'm using a drawer menu, so I use the bottom tabs into a fragment. But when I open the drawer, tabs are above the drawer.
Hello, I used the code below, the frame layout have recyclerview, but it doesn't show with BottomBar, only recyclerview or bottombar not both..
<?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"
android:orientation="vertical">
<com.roughike.bottombar.BottomBar
android:id="@+id/bb_bottom_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" />
<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
will you release a gradle?
and is this library have been finished for stable use? do you still have some import feature to add or modify?
Thank you for your great job~
Best Wishes~
Hi, this was a fast release! I was just reading about this a couple of days ago.
I noticed that the second gif you posted does not follow the material design specs. The active & inactive items don't shrink or expand.
Awesome job with the library!
I was surprised to see that selectTabAtPosition(...)
only updates the selected tab and not the current fragment. It should update both or there should be a separate method that does it.
I don't know if it was already reported, but when I implement this library and try to attach a snack bar like so:
Snackbar.make(bottomBar, "Some text", Snackbar.LENGTH_LONG).show();
I get this result (The snackbar overlays the bottom bar).
According to the guidelines it should look like this.
And once again, thank you for this great and quick implementation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.