Glass Bottom Bar

Create a glass bottom bar

Goals

  • Create a glass bottom bar over the MainNavHost.

Here is what MainNavHost looks like:

What you will learn

  • Create and draw backdrops

  • Apply effects to the backdrops

  • Handle the background drawing correctly

  • Ensure the readability

Steps

1

Draw backdrop and add lens effect

Noooo! The effect is wrong! There are transparent pixels in the bottom bar. Because we only draw the MainNavHost , the background outside of MainNavHost should be drawn too.

2

Draw the background to the backdrop (optional)

Nice work!

Try to adjust the lens effect and observe what will happen.

3

Add blur effect

The use of vibrancy() enhances the saturation, giving us more visual impact.

4

Add surface for readability

The readability has increased. You must balance between beauty and readability.

5

Final code

Exercise: Add a tinted glass icon button

chevron-rightFinal codehashtag

It is recommended to use BlendMode.Hue , so that the hue of backdrop will adapt to the tint color.

Last updated