1

I am currently working on a photogallery and I want to create a description layout which will be shown by scrolling up for each photograph, just like on the screenshots I've taken. How can I do that?

Here is my layout:

<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
tools:context=".DetailActivity"
android:clipToPadding="false">

<androidx.viewpager.widget.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    android:elevation="0dp"
    android:translationZ="0dp"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<com.google.android.material.appbar.AppBarLayout
    android:id="@+id/app_bar_detail"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="#50000000"
    app:elevation="0dp"
    app:layout_constraintTop_toTopOf="parent"
    android:clipToPadding="false"
    android:fitsSystemWindows="true">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar_detail"
        style="@style/Theme.MaterialComponents.Light"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="#00000000"
        app:title="@string/app_name"
        app:titleTextColor="#FFFFFF">

    </androidx.appcompat.widget.Toolbar>

</com.google.android.material.appbar.AppBarLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

Thanks! Photo 1

Photo 2

  • It's a [`BottomSheet` - official docs](https://developer.android.com/reference/com/google/android/material/bottomsheet/BottomSheetBehavior). You can also look at [this medium article](https://medium.com/@droidbyme/android-bottom-sheet-7e9cfcec6427) demonstrating its use as a `BottomSheet` `Dialog` and `Fragment`. – Lalit Fauzdar Aug 19 '20 at 13:23
  • Does this answer your question? [Android How to implement Bottom Sheet from Material Design docs](https://stackoverflow.com/questions/26721403/android-how-to-implement-bottom-sheet-from-material-design-docs) – Lalit Fauzdar Aug 19 '20 at 13:25
  • Yes, it does, but I actually want to open up the bottom sheet not by clicking a button but instead by swiping the photo up. I want the photo to be replaced by the bottom sheet instead of being covered by it.(Just like in Android 10 gallery) – Hayk Nazaryan Aug 20 '20 at 10:27

0 Answers0