Button that disappears when scrolling the screen

Asked

Viewed 69 times

0

Hey, guys, could you help me out in the community? I’m wanting to make my app button hide when I scroll the screen up, and appear when I scroll down. Like the application in the image below, when we roll the screen up the button disappears, when we scroll down it reappears. Unfortunately I have no idea how to do it. Someone could help me or tell me something?

Is inside an android.support.design.widget.Coordinatorlayout

<?xml version="1.0" encoding="utf-8"?>

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_home" />

<Button
    android:id="@+id/btnAd"
    android:layout_width="180dp"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|center"
    android:layout_marginBottom="30dp"
    android:background="@drawable/btnad"
    android:drawableStart="@drawable/ic_camera_alt_black_24dp"
    android:padding="15dp"
    android:textStyle="bold"
    android:text="@string/btnad"
    android:textColor="@color/background_color" />

inserir a descrição da imagem aqui

  • you use recyclerview?

  • give a look here https://guides.codepath.com/android/Floating-Action-Buttons

  • Wallace Roberto will take a look.

  • Anderson, I already used Fab, but I removed it because it doesn’t allow customization on the buttons as I wanted.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.