您好,登錄后才能下訂單哦!
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。