当前位置:网站首页>Use the open source project [banner] to achieve the effect of rotating pictures (with dots)
Use the open source project [banner] to achieve the effect of rotating pictures (with dots)
2022-07-02 02:22:00 【Rannki】
banner Open source project address :GitHub - youth5201314/banner: Banner 2.0 coming !Android Advertising image rotation control , Internally based on ViewPager2 Realization ,Indicator and UI You can customize .
Add network access :
<uses-permission android:name="android.permission.INTERNET" />
stay 【Android Manifest.xml】 Medium 【application】 Join in 【android:usesCleartextTraffic="true"】 Use clear text network request , Otherwise, you have to http Access changed to https visit .API Level 28 Or higher level applications default to “ false”,false Identify the meaning of refusing applications to use plaintext network requests .
Add dependency :
implementation 'io.github.youth5201314:banner:2.2.2' // banner rely on implementation 'com.github.bumptech.glide:glide:4.12.0' //glide Load network image dependency
Add... To the layout file :
<com.youth.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="300dp"
app:layout_constraintBottom_toTopOf="@+id/btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>MainActivity Add :
List<String> bannerList = new ArrayList<>();
bannerList.add("http://ww4.sinaimg.cn/large/006uZZy8jw1faic21363tj30ci08ct96.jpg");
bannerList.add("http://ww4.sinaimg.cn/large/006uZZy8jw1faic259ohaj30ci08c74r.jpg");
bannerList.add("http://ww4.sinaimg.cn/large/006uZZy8jw1faic2b16zuj30ci08cwf4.jpg");
bannerList.add("http://ww4.sinaimg.cn/large/006uZZy8jw1faic2e7vsaj30ci08cglz.jpg");
Banner banner = findViewById(R.id.banner);
banner.setAdapter(new BannerImageAdapter<String>(bannerList) {
@Override
public void onBindView(BannerImageHolder holder, String data, int position, int size) {
Glide.with(holder.itemView)
.load(data)
.apply(RequestOptions.bitmapTransform(new RoundedCorners(30)))
.into(holder.imageView);
}
}).addBannerLifecycleObserver(this).setBannerRound(30).setIndicator(new CircleIndicator(this));Open the app to see , The carousel map is realized , It also comes with small dots .
边栏推荐
- How to use redis ordered collection
- [learn C and fly] day 5 chapter 2 program in C language (Exercise 2)
- leetcode2309. 兼具大小写的最好英文字母(简单,周赛)
- MySQL主从延迟问题怎么解决
- Openssl3.0 learning XXI provider encoder
- WebGPU(一):基本概念
- How does MySQL solve the problem of not releasing space after deleting a large amount of data
- Sword finger offer II 031 Least recently used cache
- Summary of some experiences in the process of R & D platform splitting
- How to hide the scroll bar of scroll view in uniapp
猜你喜欢

How to run oddish successfully from 0?

As a software testing engineer, will you choose the bank post? Laolao bank test post
![[learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)](/img/39/42b1726e5f446f126a42d7ac673dce.png)
[learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)

Comparative analysis of MVC, MVP and MVVM, source code analysis
![[technology development -21]: rapid overview of the application and development of network and communication technology -1- Internet Network Technology](/img/2d/299fa5c76416f74bd1a693c433dd09.png)
[technology development -21]: rapid overview of the application and development of network and communication technology -1- Internet Network Technology
![[pit] how to understand](/img/e9/f5315a03b6f3da07021f915bb18af8.jpg)
[pit] how to understand "parameter fishing"
![[liuyubobobo play with leetcode algorithm interview] [00] Course Overview](/img/1c/c8cab92c74b6658c3ef608c5255f1f.png)
[liuyubobobo play with leetcode algorithm interview] [00] Course Overview

A quick understanding of analog electricity

A quick understanding of digital electricity

golang---锁
随机推荐
研发中台拆分过程的一些心得总结
Opencascade7.6 compilation
【读书笔记】程序员修炼手册—实战式学习最有效(项目驱动)
Sword finger offer 31 Stack push in and pop-up sequence
STM32F103——两路PWM控制电机
If you want to rewind the video picture, what simple methods can you use?
[question] - why is optical flow not good for static scenes
leetcode2310. 个位数字为 K 的整数之和(中等,周赛)
剑指 Offer 62. 圆圈中最后剩下的数字
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
【做题打卡】集成每日5题分享(第二期)
CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
leetcode2311. 小于等于 K 的最长二进制子序列(中等,周赛)
how to add one row in the dataframe?
[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)
CSDN article underlined, font color changed, picture centered, 1 second to understand
Redis环境搭建和使用的方法
Mathematics in Sinorgchem: computational geometry
CSDN insertion directory in 1 second
Query word weight, search word weight calculation