the ugly top space still exists #53
I have the same issue with Version 1.1.5. This is my Activity Layout :
https://gist.github.com/bhargavgit/6642a4bbe97f9542bbe6
And this is how I am adding it to in the Java Code :
Hey. @zhangzhzh If you are not gonna use any scroll in you fragment in 1.1.6, just use mBottomBar.useOnlyStatusBarTopOffset();
. For me it works!
Anyway I found a new issue but I think is related. It doesn't work if we attach a recycleview. The toolbar doesn't completely disappear when we scroll, just the top half of it if mBottomBar.useOnlyStatusBarTopOffset();
is enabled.
On the other side if we use mBottomBar.noTopOffset();
it only shows the bottom half of the Toolbar without scroll like in the example image provided in this issue. In this case when we scroll all the toolbar is correctly hided.
Thanks
Yep I think that I have found what causes this issue and it's the app:layout_scrollFlags="scroll|enterAlways"
attribute on the Toolbar at least in my case but don't know how to fix it.
@roughike
activity_main.xml:
`
<?xml version="1.0" encoding="utf-8"?>
LinearLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/colorPrimary"
tools:context=".activity.MainActivity">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar" />
</LinearLayout>
<FrameLayout
android:id="@+id/container_body"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
/LinearLayout
`
fragment_home.xml:
`
FrameLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.HomeFragment">
<android.support.v7.widget.RecyclerView
android:id="@+id/myCardList"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
FrameLayout
`
toolbar.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
local:popupTheme="@style/Toolbar_Popup" />
MainActivity.java:
`
public class MainActivity extends AppCompatActivity {
private Toolbar mToolbar;
private BottomBar mBottomBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
mBottomBar = BottomBar.attach(this, savedInstanceState);
mBottomBar.hideShadow();
mBottomBar.noTopOffset();
mBottomBar.setItemsFromMenu(R.menu.menu_bottombar, new OnMenuTabSelectedListener() {
@Override
public void onMenuItemSelected(int resId) {
switch (resId) {
case R.id.bottomBarHome:
displayView(0);
break;
case R.id.bottomBarItem2:
displayView(1);
break;
case R.id.bottomBarItem3:
displayView(2);
break;
case R.id.bottomBarItem4:
displayView(3);
break;
case R.id.bottomBarItem5:
displayView(4);
break;
default:
displayView(0);
break;
}
}
});
displayView(0);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// Necessary to restore the BottomBar's state, otherwise we would
// lose the current tab on orientation change.
mBottomBar.onSaveInstanceState(outState);
}
private void displayView(int position) {
Fragment fragment;
switch (position) {
case 0:
fragment = new HomeFragment();
break;
case 1:
fragment = new Item2Fragment();
break;
case 2:
fragment = new Item3Fragment();
break;
case 3:
fragment = new Item4Fragment();
break;
case 4:
fragment = new Item5Fragment();
break;
default:
fragment = new HomeFragment();
break;
}
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.container_body, fragment);
fragmentTransaction.commit();
}
}
`
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.