Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
youth5201314 committed Sep 19, 2016
1 parent 99fdfce commit e37eccd
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/src/main/java/com/test/banner/BannerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_banner);
getSupportActionBar().setTitle(getIntent().getStringExtra("des"));
//本地资源图片
Integer[] image={R.mipmap.a,R.mipmap.b,R.mipmap.c,R.mipmap.d,R.mipmap.e,R.mipmap.f};
//网络图片
String[] images= getResources().getStringArray(R.array.url2);
//图片对应title
String[] titles= getResources().getStringArray(R.array.title);

int position=getIntent().getIntExtra("position",0);
Banner banner = (Banner) findViewById(R.id.banner1);
switch (position){
Expand Down Expand Up @@ -56,7 +61,8 @@ protected void onCreate(Bundle savedInstanceState) {
banner.setIndicatorGravity(BannerConfig.RIGHT);
break;
}
banner.setImages(images);//可以选择设置图片网址,或者资源文件,默认用Glide加载
banner.setImages(images);//设置图片网址
// banner.setImages(image);//设置资源文件
banner.setOnBannerClickListener(new OnBannerClickListener() {//设置点击事件
@Override
public void OnBannerClick(int position) {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/test/banner/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected void onCreate(Bundle savedInstanceState) {
//最简单的用法,获取控件或者new一个控件,再把设置进去就行了
String[] images= getResources().getStringArray(R.array.url);
banner = (Banner) findViewById(R.id.banner);
banner.setDelayTime(1000);
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR);
banner.setImages(images);

Expand Down
Binary file added app/src/main/res/mipmap-xhdpi/a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/c.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/d.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/e.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/f.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e37eccd

Please sign in to comment.