当前位置:网站首页>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 .
边栏推荐
- [learn C and fly] 1day Chapter 2 (exercise 2.2 find the temperature of Fahrenheit corresponding to 100 ° f)
- A quick understanding of digital electricity
- [learn C and fly] 4day Chapter 2 program in C language (exercise 2.5 generate power table and factorial table
- CoordinatorLayout + TabLayout + ViewPager2(里面再嵌套一个RecyclerView),RecyclerView的滑动冲突解决
- 离婚3年以发现尚未分割的共同财产,还可以要么
- Learning notes of software testing -- theoretical knowledge of software testing
- Vsocde has cli every time it is opened js
- DNS domain name resolution
- 2022 low voltage electrician test question simulation test question bank simulation test platform operation
- Leetcode face T10 (1-9) array, ByteDance interview sharing
猜你喜欢
Software development life cycle -- waterfall model
leetcode2312. Selling wood blocks (difficult, weekly race)
CVPR 2022 | 大连理工提出自校准照明框架,用于现实场景的微光图像增强
Query word weight, search word weight calculation
Opencascade7.6 compilation
[liuyubobobo play with leetcode algorithm interview] [00] Course Overview
[graduation season] graduate seniors share how to make undergraduate more meaningful
[learn C and fly] 3day Chapter 2 program in C language (exercise 2.3 calculate piecewise functions)
Data analysis on the disaster of Titanic
【毕业季】研究生学长分享怎样让本科更有意义
随机推荐
Vsocde has cli every time it is opened js
剑指 Offer 62. 圆圈中最后剩下的数字
【OpenCV】-5种图像滤波的综合示例
Oracle creates a user with read-only permission in four simple steps
MySQL constraints and multi table query example analysis
LFM signal denoising, time-frequency analysis, filtering
es面试题
WebGPU(一):基本概念
Sword finger offer 31 Stack push in and pop-up sequence
MySQL中一条SQL是怎么执行的
Duplicate keys detected: ‘0‘. This may cause an update error. found in
Kibana操控ES
[learn C and fly] 2day Chapter 8 pointer (practice 8.1 password unlocking)
[technology development -21]: rapid overview of the application and development of network and communication technology -1- Internet Network Technology
Construction and maintenance of business websites [13]
Redis环境搭建和使用的方法
MySQL约束与多表查询实例分析
Cesium dynamic diffusion point effect
DNS domain name resolution
Infix expression to suffix expression (computer) code