BottomBar icon indicating copy to clipboard operation
BottomBar copied to clipboard

the ugly top space still exists

Open zhangzhzh opened this issue 10 years ago • 9 comments

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. -2016-03-20-07 58 14

zhangzhzh avatar Mar 20 '16 00:03 zhangzhzh

I updated the library to version 1.1.3, check if this problem still exists.

roughike avatar Mar 20 '16 18:03 roughike

@roughike it still exists in version 1.1.3 and 1.1.4

zhangzhzh avatar Mar 21 '16 02:03 zhangzhzh

Could you provide a sample of your xml layout and how your attaching the BottomBar to it in java?

roughike avatar Mar 21 '16 02:03 roughike

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 :

https://gist.github.com/bhargavgit/6bd3729ce35eccc73097

vpbhargav avatar Mar 21 '16 13:03 vpbhargav

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

grocaDW avatar Mar 21 '16 16:03 grocaDW

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.

grocaDW avatar Mar 21 '16 17:03 grocaDW

@roughike activity_main.xml: `

LinearLayout

<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

<android.support.v7.widget.RecyclerView
    android:id="@+id/myCardList"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

FrameLayout ` toolbar.xml:

`

<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();
}

}

`

zhangzhzh avatar Mar 21 '16 23:03 zhangzhzh

This is fixed in the newest version (2.0 and up), since drawing under navbar uses different logic now and is more configurable.

roughike avatar Aug 21 '16 07:08 roughike

I have also having same problem. As per my functionality I need to use drawer menu as well as bottom navigation. If I use bottom navigation with only 3 tabs than it works fine but if I extend bottom navigation with 4 or 5 tabs than it appears white space at the top of tool bar. screen2 screen1

DarshanTrivedi avatar Sep 29 '16 10:09 DarshanTrivedi