gyf-dev / gyf-dev/ImmersionBar
你好,提个需求/BUG
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 11.5k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
我是经朋友介绍使用此库的,想用来解决我碰到的一个奇怪的需求/BUG,具体是这样的:一个Material库练习,使用的DrawerLayout、CoordinatorLayout、AppBarLayout、Toolbar来设置状态栏,首先要让状态栏背景色变透明,文字颜色黑色,然后想让Toolbar跟随页面向下滑动滚动至隐藏,这时状态栏背景色是透明的,可以很清楚的看到页面,不会被遮挡,而状态栏文字是黑色的,当和页面内容重叠时会显示在内容的上方,当再次随页面向上滑动时会显示Toolbar,并在滑动到Toolbar完全显示时,状态栏显示在ToolBar上面,跟开始一样,状态栏跟Toolbar是要有一段距离的,现在的问题是要不在完全显示Toolbar时两者间没有距离,要不跟没沉浸一样,要不就是向下滑动页面时,Toolbar会重叠到状态栏上,三种情况如下图所示,这是我用原生开发以及使用您的三方库做的,一样的情况



目前我能想到的唯一办法就算在activity中设置window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)或者是WindowCompat.setDecorFitsSystemWindows(window, false)让页面数据和状态栏融为一体,然后给Toolbar设置marginTop和paddingTop来硬编码边距,android:fitsSystemWindows属性在这个需求里没有作用,但是设置了边距之后视觉效果还是有些问题的,而且滑动时候也是,特别是当没有完全显示Toolbar时就选择menu菜单时问题特别大,但是目前实在是找不到解决办法了,请问老哥能解决吗?目前的效果图如下



Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported behavior with DrawerLayout, CoordinatorLayout, AppBarLayout, and Toolbar, using the listed window flags and WindowCompat.setDecorFitsSystemWindows settings. Compare the toolbar and status-bar positions while scrolling and opening the menu; done means the transparent status bar, black text, toolbar spacing, and menu behavior remain correct in every described scroll state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100