当前位置:网站首页>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 .
边栏推荐
- Software testing learning notes - network knowledge
- Infix expression to suffix expression (computer) code
- Spend a week painstakingly sorting out the interview questions and answers of high-frequency software testing / automated testing
- Sword finger offer 42 Maximum sum of continuous subarrays
- leetcode373. 查找和最小的 K 对数字(中等)
- SQL server calculates the daily average and annual average of the whole province
- A quick understanding of digital electricity
- How to build and use redis environment
- What is the function of the headphone driver
- JVM面试篇
猜你喜欢
Build a modern data architecture on the cloud with Amazon AppFlow, Amazon lake formation and Amazon redshift
Design and implementation of key value storage engine based on LSM tree
[pit] how to understand "parameter fishing"
No programming code technology! Four step easy flower store applet
【带你学c带你飞】3day第2章 用C语言编写程序(练习 2.3 计算分段函数)
附加:信息脱敏;
Medical management system (C language course for freshmen)
How to execute an SQL in MySQL
What are the necessary things for students to start school? Ranking list of Bluetooth headsets with good sound quality
Types of exhibition items available in the multimedia interactive exhibition hall
随机推荐
JVM interview
Leetcode face T10 (1-9) array, ByteDance interview sharing
Build a modern data architecture on the cloud with Amazon AppFlow, Amazon lake formation and Amazon redshift
使用开源项目【Banner】实现轮播图效果(带小圆点)
Es interview questions
How does MySQL solve the problem of not releasing space after deleting a large amount of data
Post infiltration flow encryption
实现一个自定义布局的扫码功能
Architecture evolution from MVC to DDD
How to execute an SQL in MySQL
AR增强现实可应用的场景
leetcode373. 查找和最小的 K 对数字(中等)
[C #] use regular verification content
leetcode2310. The one digit number is the sum of integers of K (medium, weekly)
CVPR 2022 | Dalian Institute of technology proposes a self calibration lighting framework for low light level image enhancement of real scenes
golang---锁
[liuyubobobo play with leetcode algorithm interview] [00] Course Overview
How to turn off the LED light of Rog motherboard
What is the MySQL column to row function
研发中台拆分过程的一些心得总结