Skip to content

Latest commit

 

History

History
54 lines (48 loc) · 2.08 KB

README.md

File metadata and controls

54 lines (48 loc) · 2.08 KB

SwipeToHideLayout

Simple android lib for hiding out views by draging them out of screen in the set direction.
Also provides methods for hiding and showing them manually.

Importing the library

Simply add the following dependency to your build.gradle file:

compile 'cz.martinforejt:swipetohidelayout:1.0.4'

Usage

Work with SwipeToHideLayout like with android FrameLayout.
Direction must be set (xml or setDirection(int)) or exception will be thrown! The layout must be aligned to side that is defined by direction. The width/height can not be MATCH_PARENT in sliding direction.

<cz.martinforejt.swipetohidelayout.SwipeToHideLayout
    android:id="@+id/layout_top"
    android:layout_width="match_parent"
    android:layout_height="160dp"
    android:layout_alignParentTop="true"
    app:direction="top">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="@string/swipe_me_top" />

</cz.martinforejt.swipetohidelayout.SwipeToHideLayout>
final SwipeToHideLayout top = findViewById(R.id.layout_top);
top.setOnSwipeChangeListener(new OnSwipeChangeListener() {
    @Override
    public void onSwipeChange(boolean visible, SwipeHideable swipeHideable) {
        // catch swipe
    }
});

XML attributes

direction - drag direction (left, top, right, bottom)
enabled - is dragging enabled (true, false)

Methods

public methods from SwipeHideable.java

Javadoc

https://mfori.github.io/SwipeToHideLayout/