前言
运行效果:
源码地址:
https://github.com/littlecurl/AppProjects
进去找AndroidGuide或者AndroidGuide.zip进行下载
简单介绍:
今天介绍的是一款由国人开源的第三方库,GitHub地址:https://github.com/youth5201314/banner,我看到的时候,star已经8000+了,每当看到这种国人开源库被广泛使用的时候,就像周董说的那样“我不知道作者骄傲不骄傲,反正老子挺骄傲的”。
正文
首先要在gridle文件中引入两个库:
// banner 轮播
implementation 'com.youth.banner:banner:1.4.10'
// Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
然后是xml布局
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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=".MainActivity">
<!-- 轮播图 -->
<com.youth.banner.Banner
android:id="@+id/guide_banner"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- 开始按钮 -->
<ImageView
android:id="@+id/iv_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"