Coder Social home page Coder Social logo

lzls / slidingitemmenurecyclerview Goto Github PK

View Code? Open in Web Editor NEW
40.0 2.0 4.0 195 KB

A RecyclerView that can make its child scroll horizontally, follows the user gestures to open and show the menu of the child.

License: Apache License 2.0

Java 100.00%
swiperecyclerview swipemenulistview slide-menu slidemenu swipe-menu swipemenu swipe-gestures slide-to-do slide-to-delete slidetodelete

slidingitemmenurecyclerview's Introduction

SlidingItemMenuRecyclerView

Though the styles of left sliding to open the hidden menu of RecyclerView's itemView are diverse, the common case is that they are not elegant enough. This kind of item menu imitated from a new feature as introduced in iOS 11 like iOS' current version of WeChat shows, may be an unusual one as there may not have been a similar implementation on other RecyclerView libraries yet.

Documentation

Usage

The layout file of RecyclerView's itemView needs just to follow the one below and everything will work normally without any more extra code to be written in your class file. Then set OnClickListeners for your menu items to respond to the user's interactions as needed.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp"
        android:paddingTop="5dp"
        android:paddingRight="10dp"
        android:paddingBottom="5dp"
        android:drawablePadding="10dp"
        android:drawableLeft="@mipmap/ic_launcher_round"
        android:drawableStart="@mipmap/ic_launcher_round"
        android:background="@drawable/default_selector_recycler_item"
        android:textAlignment="viewStart"
        android:gravity="center_vertical|start" />

    <FrameLayout
        android:layout_width="1000dp"
        android:layout_height="match_parent">

        <!-- Put your menu items here. The first one will be shown at the horizontal start. -->

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/orange">

            <TextView
                android:id="@+id/button_rename"
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:text="@string/rename"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:gravity="center" />
        </FrameLayout>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/red">

            <TextView
                android:id="@+id/button_delete"
                android:layout_width="100dp"
                android:layout_height="match_parent"
                android:text="@string/delete"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:gravity="center" />
        </FrameLayout>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/skyBlue">

            <TextView
                android:id="@+id/button_top"
                android:layout_width="80dp"
                android:layout_height="match_parent"
                android:text="@string/top"
                android:textSize="16sp"
                android:textColor="@android:color/white"
                android:gravity="center" />
        </FrameLayout>
    </FrameLayout>
</LinearLayout>

For more usages, please download source code to see.

Pull Requests

I will gladly accept pull requests for bug fixes and feature enhancements but please do them in the developers branch.

License

Copyright 2017–2021 刘振林

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

slidingitemmenurecyclerview's People

Contributors

lzls avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

slidingitemmenurecyclerview's Issues

swipe

@lzls I can't use the library doesn't see me in my project

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.