Coder Social home page Coder Social logo

swipeablelayout's Introduction

SwipeableLayout

A swipeable - auto resizing view group for android

Usage

build.gradle

compile 'com.wmbest.widget:swipeable-layout:1.0.+@aar'

-- or --

pom.xml

<dependency>
  <groupId>com.wmbest.widget</groupId>
  <artifactId>swipeable-layout</artifactId>
  <version>1.0.+</version>
  <type>aar</type>
</dependency>

layout.xml

<com.wmbest.widget.SwipeableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:swipe="http://schemas.android.com/apk/res-auto"
    swipe:frontView="@+id/front"
    swipe:backView="@+id/back"
    swipe:direction="right"
    >
    <View
        android:id="@id/back"
        android:layout_width="match_parent"
        android:layout_height="200dip"
        android:background="#ff00ff00"
        />
    <View
        android:id="@id/front"
        android:layout_width="match_parent"
        android:layout_height="45dip"
        android:background="#ff0000ff"
        />
</com.wmbest.widget.SwipeableLayout>

Attributes

  • frontView - The Swipeable View - required
  • backView - The Background View - required
  • tabView - This View is used to simulate the background view when the frontView is closed but doesn't cover
  • direction - Swipe Direction (Default left)
  • peekSize - Amount to keep from sliding over
  • grabSize - Amount of touch area for swiping closed

Demo

Imgur

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <com.wmbest.widget.SwipeableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        xmlns:swipe="http://schemas.android.com/apk/res-auto"
        swipe:frontView="@+id/front"
        swipe:backView="@+id/back"
        swipe:direction="right"
        >
        <View
            android:id="@id/back"
            android:layout_width="match_parent"
            android:layout_height="200dip"
            android:background="#ff00ff00"
            />
        <View
            android:id="@id/front"
            android:layout_width="match_parent"
            android:layout_height="45dip"
            android:background="#ff0000ff"
            />
    </com.wmbest.widget.SwipeableLayout>


    <com.wmbest.widget.SwipeableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dip"
        xmlns:swipe="http://schemas.android.com/apk/res-auto"
        swipe:frontView="@+id/front"
        swipe:backView="@+id/back"
        >
        <TextView
            android:id="@id/back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="40dip"
            android:background="#ff0000ff"
            android:text="BACK" />
        <TextView
            android:id="@id/front"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="#7f00ff00"
            android:text="FRONT" />
    </com.wmbest.widget.SwipeableLayout>


</LinearLayout>

swipeablelayout's People

Contributors

wmbest2 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.