实现滑动隐藏标题栏底部导航栏

ByeBurger是一款简单的Android库,仅用一行代码即可实现在滚动时隐藏标题栏或底部导航栏的功能。通过隐藏导航栏,为用户提供更多的内容展示空间,并且在向上滚动时导航栏会重新淡入。该库支持Toolbar、LinearLayout等多种视图作为标题栏,BottomNavigationView、TabLayout等作为导航视图。

ByeBurger

项目地址: githubwing/ByeBurger
简介:一句代码实现滑动隐藏标题栏底部导航栏。

Bye Burger~ this is a easy way to make your title or bottom navigation hiding on scroll like this

Bye, Bye Burger! What we learned from implementing the new Android Bottom Navigation

中文文档

image image image

Hiding on scroll: We wanted to provide as much content as possible on our user’s screens. Consequently, we decided to make the navigation hide on scroll, thus making more room for the content area. Scrolling up makes the navigation fade back in.

Shifting navigation : The Material Design bottom bar comes with a very slick animation, which is referred to as the Shifting navigation — when navigating between destinations the selected section icon is enlarged, moving the unselected element to the back. Flipping through destinations on the nav bar thus feels a bit like browsing through a carousel. We decided to utilize this effect as it adds a playful note to switching sections, which we hoped would nudge our users into navigating to different areas in the app more often. Further, the animation plays a major part in our next point…

USAGE

compile the library in your build.gralde


allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}


dependencies {
   compile 'com.github.githubwing:ByeBurger:1.2.0'
  compile 'com.android.support:design:25.0.0'
  }

You only need to change the root view to CoordinatorLayout, And add one line code "app:layout_behavior" like the bottom into ANY view, Then your view hiding on scroll. Your titleBar can be Toolbar,LinearLayout and so on. Your NavigationView can be BottomNavigationView or TabLayout, or Any View you put in xml.

<android.support.design.widget.CoordinatorLayout>

  <Viewpager />
    <Toolbar
      app:layout_behavior="@string/bye_burger_title_behavior"
  />
  <BottomTab 
   android:layout_gravity="bottom"
   app:layout_behavior="@string/bye_burger_bottom_behavior"
  />      
  <FloatingActionButton
    app:layout_behavior="@string/bye_burger_float_behavior"
  />
</android.support.design.widget.CoordinatorLayout>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值