repositories {
maven { url "https://s01.oss.sonatype.org/content/groups/public" }
}
dependencies{
//2.1.0以前jcenter的依赖
//implementation 'com.youth.banner:banner:2.1.0'
//现在Maven Central
implementation 'io.github.youth5201314:banner:2.2.2'
}
Step 2.添加权限到你的 AndroidManifest.xml
<!-- if you want to load images from the internet -->
<uses-permission android:name="android.permission.INTERNET" />
Step 3.在布局文件中添加Banner,可以设置自定义属性
!!!此步骤可以省略,可以直接在Activity或者Fragment中new Banner();
<com.youth.banner.Banner
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="高度自己设置" />