使用的依赖和权限
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <!--<uses-permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS"/>--> <uses-permission android:name="android.permission.INTERNET"/>
implementation rootProject.ext.dependencies["appcompat-v7"] implementation rootProject.ext.dependencies["constraint-layout"] implementation rootProject.ext.dependencies["retrofit2"] implementation rootProject.ext.dependencies["converter-gson"] implementation rootProject.ext.dependencies["rxjava2"] implementation rootProject.ext.dependencies["rxjava2:rxandroid"] implementation rootProject.ext.dependencies["dagger"] annotationProcessor rootProject.ext.dependencies["dagger-compiler"] implementation rootProject.ext.dependencies["adapter-rxjava"] implementation 'com.facebook.fresco:fresco:0.12.0' // 支持 GIF 动图,需要添加 implementation 'com.facebook.fresco:animated-gif:0.12.0' implementation 'com.sunfusheng:marqueeview:1.3.3' implementation 'com.android.support:support-v4:27.1.1' implementation 'com.jcodecraeer:xrecyclerview:1.3.2' implementation 'com.android.support:recyclerview-v7:27.1.1' implementation 'com.android.support:design:27.1.1'
build.gradle
apply from: "config.gradle" buildscript {}
config.gradle
ext { android = [ compileSdkVersion: 27, applicationId : "com.example.ruiyonghui.combwieruiyonghui0512", minSdkVersion : 15, targetSdkVersion : 27, versionCode : 1, versionName : "1.0" ] dependencies = [ "appcompat-v7" : "com.android.support:appcompat-v7:27.1.1", "constraint-layout": "com.android.support.constraint:constraint-layout:1.1.0", "retrofit2" : "com.squareup.retrofit2:retrofit:2.4.0", "converter-gson" : "com.squareup.retrofit2:converter-gson:2.4.0", "adapter-rxjava" : "com.squareup.retrofit2:adapter-rxjava2:2.4.0", "rxjava2" : "io.reactivex.rxjava2:rxjava:2.1.13", "rxjava2:rxandroid": "io.reactivex.rxjava2:rxandroid:2.0.2", "dagger" : "com.google.dagger:dagger:2.8", "dagger-compiler" : "com.google.dagger:dagger-compiler:2.7" ] }
activtiy_piece
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".PieceActivity"> <com.jcodecraeer.xrecyclerview.XRecyclerView android:id="@+id/recycler_duanzi" android:layout_width="match_parent" android:layout_height="match_parent"> </com.jcodecraeer.xrecyclerview.XRecyclerView> </RelativeLayout>
item_duanzi
<?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" android:layout_margin="15dp" xmlns:app="http://schemas.android.com/apk/res-auto"> <com.facebook.drawee.view.SimpleDraweeView android:id="@+id/sdv_yuan" android:layout_width="60dp" android:layout_height="60dp" android:layout_marginTop="15dp" app:actualImageScaleType="centerCrop" app:roundAsCircle="true"/> <TextView android:id="@&#