AppbarLayoutBehavior
解决AppbarLayout滑动问题的behavior
Install / Use
/learn @yuruiyin/AppbarLayoutBehaviorREADME
AppBarLayoutBehavior
解决AppbarLayout滑动问题的behavior
问题描述
- 快速滑动AppBarLayout会出现回弹;
- 快速滑动AppBarLayout到折叠状态下,立马下拉会出现抖动现象;
- 滑动AppBarLayout过程中,无法像RecyclerView那样通过手指按下停止滚动。
如何使用
gradle
Step 1. Add the JitPack repository in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency in your app build.gradle:
dependencies {
// 其中latest-version类似 v1.0.3
implementation 'com.github.yuruiyin:AppbarLayoutBehavior:latest-version'
}
xml
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:fitsSystemWindows="false"
app:layout_behavior="com.yuruiyin.appbarlayoutbehavior.AppBarLayoutBehavior"
>
......
</android.support.design.widget.AppBarLayout>
混淆
若使用support库,则需要保证support库中的代码不被混淆,请在proguard-rules.pro中添加如下配置:
# 保留support下的所有类及内部类
-keep class android.support.**{*;}
-dontwarn android.support.v4.**
# 保留继承support库的类
-keep public class * extends android.support.v4.**
-keep public class * extends android.support.v7.**
-keep public class * extends android.support.annotation.**
若已迁移到androidx,则需要添加如下配置:
-keep class com.google.android.material.** {*;}
-keep class androidx.** {*;}
-keep public class * extends androidx.**
-keep interface androidx.** {*;}
-dontwarn com.google.android.material.**
-dontnote com.google.android.material.**
-dontwarn androidx.**
参考
https://blog.csdn.net/vite_s/article/details/78901767
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
