仿京东淘宝商品详情页中视频和图⽚的轮播功能
还没有学会如何上传视频到博客上,先上传图⽚吧
案例下载地址:
视频播放借⽤了饺⼦播放器,最主要的就是适配器⾥的代码书写:
@Override
public Object instantiateItem(ViewGroup container, final int position) {
String url = (position % imgUrls.size());
if (!ains(".mp4")) {
ImageView imageView = new ImageView(mContext);
imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
// imageView.setScaleType(ImageView.ScaleType.FIT_XY);
Glide.with(mContext).load(url).into(imageView);
container.addView(imageView);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
邢岷山public void onClick(View v) {
// bannerListener.bannerClick(position % imgUrls.size());
}
});博客上传视频
return imageView;
} else {
// final VideoView videoView = new VideoView(mContext);
// Uri uri = Uri.parse(url);
清朝官员等级// videoView.setVideoURI(uri);
// videoView.start();
JZVideoPlayerStandard jzVideoPlayerStandard = new JZVideoPlayerStandard(mContext);
jzVideoPlayerStandard.setUp(url, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, "播放测试");
// Glide.with(this).load("jzvd-pic.nathen/jzvd-pic/1bb2ebbe-140d-4e2e-abd2-9e7e564f71ac.png").into(myJZVideoPlayerStandard.thumbImageView); Glide.with(mContext).(1)).into(jzVideoPlayerStandard.thumbImageView);
JZVideoPlayer.setJzUserAction(null);
container.addView(jzVideoPlayerStandard);
暗黑2死灵法师加点// videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
// @Override
// public void onCompletion(MediaPlayer mp) {
bannerListener.playEnd();
// }
// });
return jzVideoPlayerStandard;
赵丽颖演过的电视剧}
}
// public void setBannerListener(BannerListener bannerListener) {
/
/ this.bannerListener = bannerListener;
叛逆林熙蕾// }
发布评论