Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Ch4 Toolbar+TabLayout" example with transparent NavigationBar #2

Open
patrickfrei opened this issue Dec 31, 2021 · 0 comments
Open

Comments

@patrickfrei
Copy link

patrickfrei commented Dec 31, 2021

Hello,

My app uses the same principles as the "Ch4 Toolbar+TabLayout" example on your page:

<CoordinatorLayout>
	<AppbarLayout>
	 	<Toolbar/>
   	 	<TabLayout/>
	</AppbarLayout>
	<ViewPager2/>
</CoordinatorLayout>

ViewPager2 acts as container for fragments. There is one fragment per tab. Each fragment includes a RecyclerView (scrollable list). Similar to your app.

Now, I've implemented fullscreen design with insets similar to example "Ch9 Insets and Fullscreen" in accordance with the Android guidelines within MainActivity.java. I've set mlp.bottomMargin to 0 and android:paddingBottom="50dp" to ViewPager2 in order the see the list scrolling behind the transparent navbar. So far so good.

The issue that I'm now facing is, that...

  1. an ugly white bar appears at the bottom of the screen when scrolling upwards and makes the NavBar intransparent again. See a video of the issue here.
  2. I don't like the hardcoded 50dp on ViewPager2 as different devices might have different paddings.

The solution would be to know the bottom NavBar inset within my fragments. Then, I could simply apply setPadding(0,0,0, navBarPadding); + setClipToPadding(false); to the Recyclerview and could remove the 50dp from ViewPager2. Unfortunately, I don't get that info via setOnApplyWindowInsetsListener in the fragment as the function is never called there.

Do you have any plans to implement a transparent NavBar to "Ch4 Toolbar+TabLayout" and / or would like to share some of your know-how about the issue that I'm facing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant