Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

CustomBehavior

> 编程语言
Open source

自定义Behavior,实现QQ联系人tab和header动画

187 stars0 likes0 views
WebsiteGitHub

About

自定义Behavior,实现QQ联系人tab和header动画

CustomBehavior

自定义CoordinatorLayout的Behavior,实现QQ联系人tab和header动画

效果

大概思路

  1. 布局 主要分三部分,header TabLayout ViewPager,由于CoordinatorLayout继承自ViewGroup,类似FrameLayout,所以需要将子View定位,定位思路重写onLayoutChild,细节查看HeaderTabViewBehavior和HeaderViewPagerBehavior
    • Tab依赖于Header
    • ViewPager依赖于Tab
  2. 滑动 在onNestedPreScroll内处理header的垂直平移

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Java

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言