-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'github/master'
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Banner [](https://jitpack.io/#Brioal/Banner) | ||
仿知乎日报首页轮播图 | ||
效果对比演示 | ||
|
||
| | ||
|
||
#usage | ||
##Step 1. Add the JitPack repository to your build file | ||
|
||
###Add it in your root build.gradle at the end of repositories: | ||
``` | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url "https://jitpack.io" } | ||
} | ||
} | ||
``` | ||
##Step 2. Add the dependency | ||
``` | ||
dependencies { | ||
compile 'com.github.Brioal:Banner:1.0' | ||
} | ||
``` | ||
|
||
``` | ||
mList = new ArrayList<>(); | ||
mList.add(new BannerEntity(1, "http://123.206.20.217/testimage/img_1.png", "第一个提示", "第一个链接")); | ||
mList.add(new BannerEntity(2, "http://123.206.20.217/testimage/img_2.png", "第二个提示", "第二个链接")); | ||
mList.add(new BannerEntity(3, "http://123.206.20.217/testimage/img_3.png", "第三个提示", "第三个链接")); | ||
mList.add(new BannerEntity(4, "http://123.206.20.217/testimage/img_4.png", "第四个提示", "第四个链接")); | ||
mList.add(new BannerEntity(5, "http://123.206.20.217/testimage/img_5.png", "第五个提示", "第五个链接")); | ||
mBanner.setList(mList); | ||
mBanner.setPagerClickListener(new OnPagerClickListener() { | ||
@Override | ||
public void onClick(BannerEntity entity, int position) { | ||
if (mToast == null) { | ||
mToast = Toast.makeText(MainActivity.this, entity.getTip(), Toast.LENGTH_SHORT); | ||
} else { | ||
mToast.setText(entity.getClickUrl()); | ||
} | ||
mToast.show(); | ||
} | ||
}); | ||
``` |