您好,登录后才能下订单哦!
ViewPage滑动加载大图和点击关注效果,viewpager滑动页面加载多张图片效果,
和点击关注按钮时候的状态变化效果。
本项目来源:https://github.com/SerhatSurguvec/Double-Tap-To-Like
大体实现代码:ViewPagerAdapter里面主要实现。
//ViewPager
public class ViewPagerAdapter extends PagerAdapter {
// Declare Variables
Context context;
LayoutInflater inflater;
int[] p_w_picpaths;
public ViewPagerAdapter(Context context, int[] p_w_picpaths) {
this.context = context;
this.p_w_picpaths = p_w_picpaths;
}
@Override
public int getCount() {
return 5;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((RelativeLayout) object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView p_w_picpathview;
final ImageView heartAnim;
final ImageView likeImg;
final TextView likeCount;
TextView whichOfThem;
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.viewpager_item, container,
false);
// Locate the ImageView in viewpager_item.xml
p_w_picpathview = (ImageView) itemView.findViewById(R.id.p_w_picpath);
heartAnim = (ImageView) itemView.findViewById(R.id.heart_anim);
likeImg = (ImageView) itemView.findViewById(R.id.item_comment_like_img);
likeCount = (TextView) itemView.findViewById(R.id.item_comment_like_count);
whichOfThem = (TextView) itemView.findViewById(R.id.which);
whichOfThem.setText((position + 1) + "/" + 5);
p_w_picpathview.setImageResource(p_w_picpaths[position]);
final GestureDetector gd = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onDoubleTap(MotionEvent e) {
Animation pulse_fade = AnimationUtils.loadAnimation(context, R.anim.pulse_fade_in);
pulse_fade.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
heartAnim.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationEnd(Animation animation) {
heartAnim.setVisibility(View.GONE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
heartAnim.startAnimation(pulse_fade);
likeImg.setImageDrawable(context.getResources().getDrawable(R.drawable.like_active));
likeCount.setText("3 Likes");
return true;
}
@Override
public void onLongPress(MotionEvent e) {
super.onLongPress(e);
}
@Override
public boolean onDoubleTapEvent(MotionEvent e) {
return true;
}
});
p_w_picpathview.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return gd.onTouchEvent(event);
}
});
// Add viewpager_item.xml to ViewPager
(container).addView(itemView);
return itemView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// Remove viewpager_item.xml from ViewPager
((ViewPager) container).removeView((RelativeLayout) object);
}
}
ViewPage滑动加载大图和点击关注效果
AVLoadingIndicatorView各种加载效果
MeiTuanRefreshListView高仿美团下拉刷新
完整阅读软件客户端app
LearnHut_android 学习客户端源码
AutoHomeRefreshListView仿汽车之家下拉刷新
PercentageBar自定义动态柱形图
Hide-Music-Player 一个完整的音乐播放器
FoldableLayout展开效果
Progre***oundButton下载进度按钮变化动画
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。