The Startup
Published in

The Startup

A Persistent Bottom Sheet-Like Instagram Insights | How to Create a Persistent Bottom Sheet in Android Studio

In this blog post, we’re going to . Nowadays most app using this material design concept in their applications. Before implementing it let’s see what the bottom sheet is.

What is Bottom Sheet?

The android Bottom Sheet component is used to showing the more relevant content that slides up from the bottom. You can notice bottom sheets in apps like Map apps, music players, LinkedIn, etc. The bottom Sheet is the component of the Android Design Support Library.

In android, there are two types of bottom sheets that use most of the time, Persistent Bottom Sheet and Modal Bottom Sheet.

  • Persistent Bottom Sheet: It shows in-app content. It will display at the bottom of the mobile screen making some amount of the content visible. When activated it opens the full content that means when we slide up the bottom sheet it shows the remaining content of the sheet. Example: Instagram app (which we will make below)
  • Modal Bottom Sheet: Modal bottom sheets have a higher elevation than the app. These usually replace menus or dialogs in the app, generally, a model bottom sheet is used to show the linked content from other apps. Example: Google Drive app

What you’re looking for

Here I create a bottom sheet dialog that is as like as Instagram Insights page bottom sheet. Demo video:

Add the dependency

In build.gradle

Create the main XML

Now create an action button to show the bottom sheet in the main XML file (/res/layout/activity_main.xml).

In this imageview we set our bottom sheet.

Create bottom sheet

Now create a new layout file for the bottom sheet (/res/layout/bottom_sheet.xml) and add your fields.

Add functionality

In the main java file create a hook for the bottom sheet, also initialize our imageview where we need to set the onclick for the bottom sheet.

Source code:

activity_main.xml

layout_bottom_sheet.xml

MainActivity.java

Follow me on

Github: Golap Gunjan Barman (barmangolap15)

Instagram: @androidapps.developer.blogs

Facebook: GBAndroidBlogs

Website/Blog: www.gbandroidblogs.com

--

--

Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +768K followers.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Golap Gunjan Barman

Hi everyone, myself Golap an Android app developer with UI/UX designer.