我正在尝试在我的项目中实现daimajia imageSlider库。除了单击滑块图像时应该显示Toast消息的click listener部分,其他所有功能都完美无缺!有什么方法可以做到这一点吗?我已将click侦听器实现为:
+--------------+----------+
| Article_Name | COUNT(*) |
+--------------+----------+
| Penguins | 2 |
| Lions | 1 |
| Tigers | 2 |
+--------------+----------+
答案 0 :(得分:2)
SliderLayout sliderLayout = (SliderLayout) view.findViewById(R.id.home_slider);
final List<String> urls = slideImageURLLists();
for(int i = 0; i<urls.size();i ++){
DefaultSliderView defaultSliderView = new DefaultSliderView(mContext);
final int finalI = i;
defaultSliderView.image(urls.get(i))
.setOnSliderClickListener(new BaseSliderView.OnSliderClickListener() {
@Override
public void onSliderClick(BaseSliderView slider) {
Toast.makeText(mContext, "clicked image="+urls.get(finalI), Toast.LENGTH_SHORT).show();
}
});
sliderLayout.addSlider(defaultSliderView);
答案 1 :(得分:0)
textSliderView.setOnSliderClickListener(new BaseSliderView.OnSliderClickListener() {
@Override
public void onSliderClick(BaseSliderView slider){
}
});