美文网首页
Item侧滑控件

Item侧滑控件

作者: Wocus | 来源:发表于2018-08-02 14:53 被阅读132次

原文地址:https://github.com/anzaizai/EasySwipeMenuLayout

使用步骤

1.依赖注入

compile 'com.github.anzaizai:EasySwipeMenuLayout:1.1.2'

2.布局文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <com.guanaj.easyswipemenulibrary.EasySwipeMenuLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:contentView="@+id/content"
        app:leftMenuView="@+id/left"
        app:rightMenuView="@+id/right">
        <LinearLayout
            android:id="@+id/left"
            android:layout_width="100dp"
            android:layout_height="wrap_content"
            android:background="@android:color/holo_blue_dark"
            android:orientation="horizontal"
            android:padding="20dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="分享" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/content"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#cccccc"
            android:orientation="vertical"
            android:padding="20dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="内容区域" />
        </LinearLayout>
        <LinearLayout
            android:id="@+id/right"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/holo_red_light"
            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@android:color/holo_blue_bright"
                android:padding="20dp"
                android:text="删除" />
            <TextView
                android:id="@+id/right_menu_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@android:color/holo_orange_dark"
                android:padding="20dp"
                android:text="收藏" />
        </LinearLayout>
    </com.guanaj.easyswipemenulibrary.EasySwipeMenuLayout>

</RelativeLayout>

相关文章

网友评论

      本文标题:Item侧滑控件

      本文链接:https://www.haomeiwen.com/subject/ezzjvftx.html