一、导入依赖
compile 'me.yuqirong:cardswipelayout:1.0.0' // recylerview依赖: compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
二、布局文件
1、activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <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:orientation="vertical" tools:context="com.xwj.lenovo.my_huadong.MainActivity"> <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="match_parent" /> </LinearLayout>
2、item.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="336dp" android:layout_height="426dp" android:background="@drawable/img_card_background" android:gravity="center" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <com.xwj.lenovo.my_huadong.RoundImageView 《--------------这里要改成自己包下的,否则报错 android:id="@+id/iv_avatar" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" app:radius="7.5dp" android:src="@drawable/img_avatar_01" /> <

本文详细介绍了如何实现仿探探应用的左右滑动功能,包括导入依赖、布局文件设置、drawable和value中XML文件的创建,以及MainActivity和RoundImageView的代码实现。遵循这些步骤,可以轻松构建类似探探的滑动界面。

468

被折叠的 条评论
为什么被折叠?



