Comments (33)
You could try bottomBar.attach(findViewById(R.id.sv_items_wrapper), savedInstanceState)
. If that doesn't work, try attaching it to different views you have.
If this doesn't work, let me know and I'll try my best to fix it during this weekend.
Right now I have some important business (=getting shitfaced with cheapest possible beer) to do, but I'll get back to you in a couple days.
from bottombar.
I'm testing it on a virtual x86 Nexus 6P running android N.
from bottombar.
Looks like it's not drawing behind the Navigation Bar on that device.
I probably know the solution for this problem, and I'll fix this in a couple days.
from bottombar.
Try adding one more item and see if that makes a difference
from bottombar.
I will investigate this.
from bottombar.
How many tabs do you have in your XML menu?
from bottombar.
I tried with both 4 and 5
from bottombar.
What device are you testing this on?
from bottombar.
I'll test it now on my actual android 6.0.1 Nexus 6P.
from bottombar.
Well that's very odd.
When I run it on my actual device it looks like this
I'll double check my code to see if I modify anything related to the navbar, although I don't think I do.
That's how it looks on the virtual Nexus 6P device
from bottombar.
That is a weird bug I'm aware of. The top offset can be removed by calling bottomBar.noTopOffset()
, but that is a hacky fix and won't probably fix the bottom stuff.
You're also probably using a CoordinatorLayout with fitsSystemWindows="true"
, which currently produces weird behavior. Try removing the fitsSystemWindows
attribute and attaching the BottomBar to other Views by using bottomBar.attach(View view, Bundle savedInstanceState)
.
Could you post the whole XML code your using in that layout so I could investigate and try to fix this?
from bottombar.
I added the bottomBar.noTopOffset()
and removed fitsSystemWindows="true"
from my layouts, though I'm not sure which views I should attach.
Here are my layout files:
activity_scrolling.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/clWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.fakeforsnapchat.Activities.ScrollingActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include layout="@layout/top" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_scrolling" />
</LinearLayout>
</FrameLayout>
content_scrolling.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/sv_items_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background"
tools:context="com.fakeforsnapchat.Activities.ScrollingActivity"
tools:showIn="@layout/activity_scrolling">
<LinearLayout
android:id="@+id/sv_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</ScrollView>
top.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="25dp"
android:orientation="vertical"
tools:showIn="@layout/activity_scrolling">
<com.quinny898.library.persistentsearch.SearchBox
android:id="@+id/sbSearch"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
from bottombar.
I got it to work by attaching it to R.id.main_content.
Thank you very much you quick support.
from bottombar.
I now noticed that there is a weird spacing above the bottom bar with this solution
Is this a known issue?
from bottombar.
Are you using noTopOffset()
?
from bottombar.
Yes, I do
from bottombar.
If you are, try removing it.
from bottombar.
Back to this
from bottombar.
Try useOnlyStatusBarTopOffset()
instead. If that doesn't work, I'll try to fix this when I can.
from bottombar.
Here is my current code:
bottomBar = BottomBar.attach(this, savedInstanceState);
BottomBar.attach(findViewById(R.id.clWrapper), savedInstanceState);
ViewCompat.setElevation(bottomBar, 8);
bottomBar.setItemsFromMenu(R.menu.bar, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int resId) {
switch (resId) {
case R.id.recents:
new toggleView().execute();
break;
case R.id.community:
new toggleView().execute();
break;
case R.id.favorites:
new toggleView().execute();
break;
}
}
});
bottomBar.mapColorForTab(0, ContextCompat.getColor(this, R.color.colorAccent));
bottomBar.mapColorForTab(1, 0xFF5D4037);
bottomBar.mapColorForTab(2, "#7B1FA2");
bottomBar.mapColorForTab(3, "#FF5252");
activity_scrolling.xml
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clWrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.fakeforsnapchat.Activities.ScrollingActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include layout="@layout/top" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_scrolling" />
</LinearLayout>
from bottombar.
Don't call attach()
twice, as it's unnecessary.
from bottombar.
When I change my code to
bottomBar = BottomBar.attach(findViewById(R.id.clWrapper), savedInstanceState);
ViewCompat.setElevation(bottomBar, 8);
bottomBar.setItemsFromMenu(R.menu.bar, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int resId) {
switch (resId) {
case R.id.recents:
new toggleView().execute();
break;
case R.id.community:
new toggleView().execute();
break;
case R.id.favorites:
new toggleView().execute();
break;
}
}
});
bottomBar.mapColorForTab(0, ContextCompat.getColor(this, R.color.colorAccent));
bottomBar.mapColorForTab(1, 0xFF5D4037);
bottomBar.mapColorForTab(2, "#7B1FA2");
bottomBar.mapColorForTab(3, "#FF5252");
It looks like this
When I change my code to
bottomBar = BottomBar.attach(findViewById(R.id.clWrapper), savedInstanceState);
bottomBar.noTopOffset();
ViewCompat.setElevation(bottomBar, 8);
bottomBar.setItemsFromMenu(R.menu.bar, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int resId) {
switch (resId) {
case R.id.recents:
new toggleView().execute();
break;
case R.id.community:
new toggleView().execute();
break;
case R.id.favorites:
new toggleView().execute();
break;
}
}
});
bottomBar.mapColorForTab(0, ContextCompat.getColor(this, R.color.colorAccent));
bottomBar.mapColorForTab(1, 0xFF5D4037);
bottomBar.mapColorForTab(2, "#7B1FA2");
bottomBar.mapColorForTab(3, "#FF5252");
It looks like this
from bottombar.
Great, thanks
from bottombar.
Now should work.
mBottomBar = BottomBar.attach(this, savedInstanceState);
// If you get that weird-looking top space, this fixes it:
// mBottomBar.noTopOffset();
from bottombar.
Still doesn't work for me..
Screenshot
Code:
bottomBar = BottomBar.attach(this, savedInstanceState);
bottomBar.noTopOffset();
bottomBar.setItemsFromMenu(R.menu.bar, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int resId) {
switch (resId) {
case R.id.recents:
new toggleView().execute();
break;
case R.id.community:
new toggleView().execute();
break;
case R.id.favorites:
new toggleView().execute();
break;
}
}
});
bottomBar.mapColorForTab(0, ContextCompat.getColor(this, R.color.colorAccent));
bottomBar.mapColorForTab(1, 0xFF5D4037);
bottomBar.mapColorForTab(2, "#7B1FA2");
bottomBar.mapColorForTab(3, "#FF5252");
from bottombar.
OH, wait a minute.
I think I might know why
from bottombar.
OK, I now know why.
It seems like this library is in conflict with 'MaterialDrawer', if I do not initialize the drawer, everything works just fine.
from bottombar.
Are you initializing the MaterialDrawer before or after BottomBar?
from bottombar.
Furthermore, if I initialize the materialdrawer before the BottomBar, the bottombar works fine, but the navbar gets a little messed up
from bottombar.
And another thing, when I intialize the materialdrawer before the bottombar, the weird spacing above the bottom bar reappears.
from bottombar.
It has to do with MaterialDrawer not drawing behind the Navigation Bar.
BottomBar can't extend there because it is a child of MaterialDrawer. You should figure how to get the MaterialDrawer to draw behind the Navigation Bar.
from bottombar.
Or maybe I could try if changing elevation works. If it does, I'll expose a method for changing it so you could use the sweet navbar goodness and MaterialDrawer.
from bottombar.
I'll close this issue as it's MaterialDrawer specific and not directly related to this library.
from bottombar.
Related Issues (20)
- Not support set badge count in text format HOT 3
- Bump to version 26 HOT 1
- bottom bar not working on first time
- Change The BottomBar selected with Swipe Gesture
- How to change the icon in the code?
- Does it support changing the title color only? HOT 1
- How can I change the color of bottom bar item title , without affecting the bottom bar icon ?
- How do I remove the shadow of the click HOT 1
- Call Fragment onTabSelect
- "iconsOnly" doesn't center the icon in the view container
- BottomBar crashes when "minSdkVersion" is set to 21 HOT 1
- BottomBarBadge is not accessible.
- Crash: NullPointerException
- Vector image
- disable first tab autoselection HOT 2
- Programmatically activate tab without firing events
- Shy behaviour is not working
- open third tab onstart HOT 3
- Will this library support in SDK level 30 ?
- 可否实现选中一个图片,未选中一个图片 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bottombar.