Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] android – Bottom Sheet Behavior peek height also including the height of the bottom navigation view in phone with notch

Posted on November 14, 2022

Solution 1 :

void BottomSheetBehavior.setGestureInsetBottomIgnored(boolean gestureInsetBottomIgnored)

Sets whether this bottom sheet should adjust it’s position based on the system gesture area on Android Q and above.

Problem :

I have a fragment with a bottom sheet inside coordinator layout. I am setting the peak height of the sheet as 60 dp. It looks fine on a phone without a notch.
But in a phone with a notch, it is also including the height of the bottom navigation view of the phone. So lets say if the height of bottom navigation is also 60 dp then the bottom sheet is showing a peak height of 120 dp instead of 60 dp. Testing on Samsung M31.

Layout file –

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns_android="http://schemas.android.com/apk/res/android"
    xmlns_app="http://schemas.android.com/apk/res-auto">

    <data>

    </data>

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android_layout_width="match_parent"
        android_layout_height="match_parent">

        <FrameLayout
            android_id="@+id/scanner_container"
            android_layout_width="match_parent"
            android_layout_height="match_parent" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android_id="@+id/header_layout"
            android_layout_width="match_parent"
            android_layout_height="wrap_content"
            android_minHeight="@dimen/dp_150"
            android_background="@color/dashboard_bg"
            android_paddingStart="@dimen/dp_25"
            android_paddingBottom="@dimen/dp_40"
            android_paddingEnd="@dimen/dp_25">

            <ImageView
                android_id="@+id/logo_imageview"
                android_layout_width="@dimen/dp_50"
                android_layout_height="@dimen/dp_50"
                android_background="@drawable/circle_white"
                app_layout_constraintBottom_toBottomOf="parent"
                app_layout_constraintStart_toStartOf="parent"
                app_layout_constraintTop_toTopOf="parent" />

            <LinearLayout
                android_id="@+id/company_details_linear_layout"
                android_layout_width="0dp"
                android_layout_height="wrap_content"
                android_layout_marginStart="@dimen/dp_15"
                android_layout_marginEnd="@dimen/dp_25"
                android_orientation="vertical"
                app_layout_constraintBottom_toBottomOf="@id/logo_imageview"
                app_layout_constraintEnd_toStartOf="@+id/imageView3"
                app_layout_constraintStart_toEndOf="@+id/logo_imageview"
                app_layout_constraintTop_toTopOf="@id/logo_imageview">

                <TextView
                    android_layout_width="wrap_content"
                    android_layout_height="wrap_content"
                    android_fontFamily="@font/open_sans"
                    android_text="@string/welcome"
                    android_textSize="@dimen/sp_14" />

                <TextView
                    android_layout_width="wrap_content"
                    android_layout_height="wrap_content"
                    android_layout_marginTop="@dimen/dp_4"
                    android_fontFamily="@font/open_sans_bold"
                    android_text="@string/company_name"
                    android_textSize="@dimen/sp_14" />
            </LinearLayout>

            <ImageView
                android_id="@+id/help_imageview"
                android_layout_width="wrap_content"
                android_layout_height="wrap_content"
                android_src="@drawable/ic_help"
                app_layout_constraintEnd_toEndOf="parent"
                app_layout_constraintTop_toTopOf="@id/company_details_linear_layout" />

            <ImageView
                android_id="@+id/imageView3"
                android_layout_width="wrap_content"
                android_layout_height="wrap_content"
                android_layout_marginEnd="@dimen/dp_25"
                android_adjustViewBounds="true"
                android_src="@drawable/ic_notification"
                app_layout_constraintEnd_toEndOf="parent"
                app_layout_constraintEnd_toStartOf="@+id/help_imageview"
                app_layout_constraintTop_toTopOf="@id/company_details_linear_layout" />

            <TextView
                android_layout_width="wrap_content"
                android_layout_height="wrap_content"
                android_layout_marginTop="@dimen/dp_6"
                android_drawableEnd="@drawable/ic_arrow_right"
                android_drawablePadding="@dimen/dp_8"
                android_drawableTint="@color/error_red"
                android_fontFamily="@font/open_sans_semibold"
                android_letterSpacing="0.01"
                android_text="@string/verify_your_account"
                android_textAllCaps="true"
                android_textColor="@color/error_red"
                android_textSize="@dimen/sp_10"
                app_layout_constraintBottom_toBottomOf="parent"
                app_layout_constraintStart_toStartOf="@id/company_details_linear_layout"
                app_layout_constraintTop_toBottomOf="@id/company_details_linear_layout"
                app_layout_constraintVertical_bias="0.0" />
        </androidx.constraintlayout.widget.ConstraintLayout>

        <include
            android_id="@+id/bottom_sheet"
            layout="@layout/dashboard_bottom_sheet"
            android_layout_width="match_parent"
            android_layout_height="match_parent"
            app_behavior_hideable="false"
            app_behavior_peekHeight="@dimen/dp_60"
            app_layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" />
    </androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
READ  [ANSWERED] How to make a notification in Android that does not collapse itself?
Powered by Inline Related Posts

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress