1.在项目build.gradle(Module:app)中实现接口
implementation 'com.youth.banner:banner:1.4.10'
implementation 'com.github.bumptech.glide:glide:4.11.0'
2.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" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <com.youth.banner.Banner android:id="@+id/banner" android:layout_width="match_parent" android:layout_height="200dp"> &