亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

ViewPage滑動加載大圖和點擊關注效果《IT藍豹》

發布時間:2020-06-04 03:47:52 來源:網絡 閱讀:212 作者:楊光成 欄目:移動開發

ViewPage滑動加載大圖和點擊關注效果

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滑動加載大圖和點擊關注效果《IT藍豹》

相關代碼

  • ViewPage滑動加載大圖和點擊關注效果

  • AVLoadingIndicatorView各種加載效果

  • MeiTuanRefreshListView高仿美團下拉刷新

  • 完整閱讀軟件客戶端app

  • LearnHut_android 學習客戶端源碼

  • AutoHomeRefreshListView仿汽車之家下拉刷新

  • PercentageBar自定義動態柱形圖

  • Hide-Music-Player 一個完整的音樂播放器

  • FoldableLayout展開效果

  • Progre***oundButton下載進度按鈕變化動畫


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

上犹县| 临江市| 奉节县| 宜州市| 牙克石市| 凤庆县| 德清县| 淅川县| 佛山市| 肇州县| 鸡东县| 姜堰市| 隆尧县| 孟村| 昭苏县| 昌江| 拉萨市| 自贡市| 寿宁县| 华安县| 涿鹿县| 保靖县| 海兴县| 仙居县| 岳池县| 邮箱| 阿荣旗| 颍上县| 贵州省| 报价| 务川| 兴城市| 砀山县| 平顶山市| 怀集县| 绥化市| 奉新县| 安泽县| 井陉县| 涞源县| 六盘水市|