smooth-app-bar-layout

授权协议 Apache-2.0 License
开发语言 Java
所属分类 手机/移动开发、 Android UI 组件
软件类型 开源软件
地区 不详
投 递 者 杨晟
操作系统 Android
开源组织
适用人群 未知
 软件概览

smooth-app-bar-layout [Deprecated]

================

[DEPRECATED] The issue that is addressed in this library is fixed from support design 26.0.0 or above (finally). Please use support design instead.

This is a smooth version of Google Support Design AppBarLayout. If you are using AppBarLayout, you will know it has an issue with fling. Check out these threads to know about that problem:http://stackoverflow.com/questions/30923889/flinging-with-recyclerview-appbarlayouthttps://code.google.com/p/android/issues/detail?id=177729...

If you find that it still doesn't meet your need, don't hesitate to send me a request. I love to work with you to solve problems. Send a request HERE

Installation

compile "me.henrytao:smooth-app-bar-layout:<latest-support-design-version>.<latest-smooth-app-bar-layout-fix>"

Example: if the latest support design version is 24.1.0 and SmoothAppBarLayout fix is 0, please use compile "me.henrytao:smooth-app-bar-layout:24.1.0.0". Please check TAGS section to see all supported versions.

  • smooth-app-bar-layout is an UI library and pretty much depended on AppCompat and Support Design. So that, versioning is quite the same with those libraries from Google.
  • smooth-app-bar-layout is deployed to jCenter. Make sure you have jcenter() in your project gradle.

Tested environments

  • "com.android.support:design:23.1.1"
  • "com.android.support:appcompat-v7:23.1.1"

Demo

Get it on Google Play

Please note that the app on the Play store is not always the latest version.

Concepts

Features

  • Scroll
  • EnterAlways
  • EnterAlwaysCollapsed
  • ExitUntilCollapsed
  • QuickReturn
  • Custom NestedScrollView (NEW)
  • ViewPager Scroll
  • ViewPager ExitUntilCollapsed (NEW)
  • ViewPager QuickReturn (NEW)
  • Support SwipeRefreshLayout

Checkout these demo videos:

Important Notes

  • Remember to set android:id for me.henrytao.smoothappbarlayout.SmoothAppBarLayout in layout file so that it can call onSaveInstanceState and onRestoreInstanceState correctly. Otherwise, it won't work correctly with onOrientationChanged.
  • Remember to set android:minHeight for me.henrytao.smoothappbarlayout.SmoothAppBarLayout in layout file if you use ViewPager.
  • clipToPadding in RecyclerView won't work. You have to set HeaderHolder in apdater and it has to be placed at index 0.

Usage

Super easy! Just need to do 3 steps:

  • Change android.support.design.widget.AppBarLayout to me.henrytao.smoothappbarlayout.SmoothAppBarLayout and set android:id
  • Remove app:layout_behavior="@string/appbar_scrolling_view_behavior".
  • Add header to your NestedScrollView or RecyclerView.

Original AppBarLayout from Google Support Design

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

  <android.support.v7.widget.RecyclerView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

  <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="@dimen/app_bar_height">

    <android.support.design.widget.CollapsingToolbarLayout
      android:id="@+id/collapsing_toolbar_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_scrollFlags="scroll|exitUntilCollapsed">

      <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        app:layout_collapseMode="pin"
        app:navigationIcon="@drawable/ic_toolbar_arrow_back"
        style="@style/AppStyle.MdToolbar" />
    </android.support.design.widget.CollapsingToolbarLayout>
  </android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>

SmoothAppBarLayout

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

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

  <me.henrytao.smoothappbarlayout.SmoothAppBarLayout
    android:id="@+id/smooth_app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/app_bar_height">

    <android.support.design.widget.CollapsingToolbarLayout
      android:id="@+id/collapsing_toolbar_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_scrollFlags="scroll|exitUntilCollapsed">

      <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        app:layout_collapseMode="pin"
        app:navigationIcon="@drawable/ic_toolbar_arrow_back"
        style="@style/AppStyle.MdToolbar" />
    </android.support.design.widget.CollapsingToolbarLayout>
  </me.henrytao.smoothappbarlayout.SmoothAppBarLayout>
</android.support.design.widget.CoordinatorLayout>

SmoothCollapsingToolbarLayout example

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

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

  <me.henrytao.smoothappbarlayout.SmoothAppBarLayout
    android:id="@+id/smooth_app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/app_bar_height">

    <android.support.design.widget.CollapsingToolbarLayout
      android:id="@+id/collapsing_toolbar_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:layout_scrollFlags="scroll|exitUntilCollapsed">

      <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        app:layout_collapseMode="pin"
        app:navigationIcon="@drawable/ic_toolbar_arrow_back"
        style="@style/AppStyle.MdToolbar" />

      <me.henrytao.smoothappbarlayout.SmoothCollapsingToolbarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="left|center_vertical"
        android:minHeight="?attr/actionBarSize"
        app:sctl_avatar_id="@+id/avatar"
        app:sctl_collapsed_avatarSize="?attr/mdIcon_sm"
        app:sctl_collapsed_offsetX="?attr/actionBarSize"
        app:sctl_collapsed_offsetY="0dp"
        app:sctl_collapsed_subtitleTextSize="14dp"
        app:sctl_collapsed_titleTextSize="16dp"
        app:sctl_expanded_avatarSize="?attr/mdIcon_lg"
        app:sctl_expanded_offsetX="?attr/mdLayout_spacing_md"
        app:sctl_expanded_offsetY="?attr/mdLayout_spacing_md"
        app:sctl_expanded_subtitleTextSize="16dp"
        app:sctl_expanded_titleTextSize="34dp"
        app:sctl_subtitle_id="@+id/subtitle"
        app:sctl_title_id="@+id/title">

        <ImageView
          android:id="@+id/avatar"
          android:layout_width="?attr/mdIcon_sm"
          android:layout_height="?attr/mdIcon_sm"
          android:layout_gravity="center_vertical"
          android:src="@drawable/ic_blank_circle" />

        <LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center_vertical"
          android:layout_marginLeft="?attr/mdLayout_spacing_md"
          android:orientation="vertical">

          <TextView
            android:id="@+id/title"
            android:text="Title"
            style="@style/MdText.Title" />

          <TextView
            android:id="@+id/subtitle"
            android:text="Subtitle"
            style="@style/MdText.Body1" />
        </LinearLayout>
      </me.henrytao.smoothappbarlayout.SmoothCollapsingToolbarLayout>
    </android.support.design.widget.CollapsingToolbarLayout>
  </me.henrytao.smoothappbarlayout.SmoothAppBarLayout>
</android.support.design.widget.CoordinatorLayout>

Contributing

Any contributions are welcome!
Please check the CONTRIBUTING guideline before submitting a new issue. Wanna send PR? Click HERE

Donation

Let's buy me some coffee ��

License

Copyright 2015 "Henry Tao <hi@henrytao.me>"

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
  • 一、跟随滑动无自动吸附、自动展开效果。 scroll|enterAlways:跟随上滑Toolbar消失,跟随下滑立即出现Toolbar、CollapsingToolbarLayout展开、子View再继续下滑。 scroll|enterAlwaysCollapsed:跟随上滑Toolbar消失,下滑至子View完毕、再跟随下滑出现Toolbar、CollapsingToolbarLayout展开

  • 前言 uni-app官方的tabBar修改字体大小和图片大小不生效,并且有闪烁的问题。自定义tab-bar可以解决这些问题 一、自定义tab-bar.vue <template> <view class="uni-tabbar"> <view class="uni-tabbar__item" v-for="(item,index) in tabbar" :key="index" @tap="

  •   去掉Android上的Title Bar  方法一:修改code  在 public void onCreate(Bundle savedInstanceState)函数体中加     this.requestWindowFeature(Window.FEATURE_NO_TITLE);  些方法明显能看到title bar显示了之后又消失了,给user的感觉不好。  方法二:修改Androi

  • 1. 简介     在Android4.4.2(KITKAT<Build.VERSION_CODES.KITKAT>)之前,只能设置:                  1)View.SYSTEM_UI_FLAG_HIDE_NAVIGATION            其缺点是当Touch Screen时,Navigation bar将显示出来。     从Android4.4.2起,可以设置:  

  • <?xml version="1.0" encoding="utf-8"?> <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res

  • ——Developer values-v14 res下文件夹values-14 values-21 Develop > Reference > R.attr displayOptions Options affecting how the action bar is displayed. Must be one or more (separated by “|”) of the following

  • 作为Activity中最上面的一部分,App Bar能够显而易见的呈现给用户常用的操作,例如设置,分享,搜索;同时App Bar也担任着显示Activity的标题,图标的作用。在Android3.0之后,menu菜单不再显示,转而显示为现在的ActionBar,用ActionBar作为App Bar,以前App Bar中的属性也逐渐转移到ActionBar中来;但是低于Android3.0(API

 相关资料
  • 此属性的类型为Boolean。 如果此值为true,则形状的边缘将是平滑的。 您可以使用setSmooth()方法为此属性设置值,如下所示 - path.setSmooth(false); 默认情况下,平滑值为true。 以下是具有两个平滑值的三角形图。

  • To make it easier for users to view a list of items, you may want to hide the app bar as the user scrolls down the list. This is especially true if your app displays a “tall” app bar that occupies a l

  • 描述 (Description) 通过将值设置为-10到+10 ,将平滑滤镜应用于图像。 例子 (Example) ![My New Image](/images/maxresdefault.jpg?cropZoom = 300, 200&smooth = 8) 输出 (Output) 上面的代码将生成以下输出 -

  • Smooth Build 是一个构建工具,提供一个函数型语言用来描述构建过程,简单而且可读性强。一个最简单的 Java 项目构建脚本就像  "app.jar: files("src") | javac | jar;" 构建的内容使用 SHA1 进行哈希缓存和索引,因此不会对同一个资源构建两次。

  • Smooth Gestures功能十分强大,提供了多达19中常用操作,可以选择使用的鼠标按键,而且可以完全按照您的需要来定制所有的手势。Smooth Gestures还有一点比同类扩展好的是可以在所有平台上使用(前面发行的扩展大多数无法在Linux下使用)。 介绍内容来自 http://www.chromepub.com/

  • Flutter Smooth 是一个可以让 Flutter 应用的滚动帧率保持在 60 FPS 的库,即便应用布局/构建的 tree 体积十分大。 效果如下(左边是没有使用该库的效果,右边是使用之后的效果):