android轮播图Banner的使用及详解
作者:互联网
1.导入依赖
'com.youth.banner:banner:1.4.9'
2.添加权限
<uses-permission android:name="android.permission.INTERNET" />//联网
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />//读取外置存储卡
3.添加布局
<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="150dp" />
4.在Activity 中编写代码,相关代码含义已经全部添加注释
public class MyBanner extends AppCompatActivity implements OnBannerListener {
private Banner banner;
private ArrayList<String> list_path;
private ArrayList<String> list_title;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
标签:轮播,Banner,savedInstanceState,private,添加,android,onCreate,banner 来源: https://blog.csdn.net/weixin_38107457/article/details/122419486