zoukankan      html  css  js  c++  java
  • gallery调用setselection时有动画的两个方法:

    gallery setselection 的动画:

    //动画效果

    public void imageViewAniamtion(int position) {

            View exit;

            View enter;

            if(position == 0){

                    exit = photo_scanner_gallery.getChildAt(0);

                    enter = photo_scanner_gallery.getChildAt(1);

            }else if(position == photoList.size() - 1){

                    return;

            }else{

                    exit = photo_scanner_gallery.getChildAt(1);

                enter = photo_scanner_gallery.getChildAt(2);

            }

            exit.startAnimation(AnimationUtils.loadAnimation(this, R.anim.photo_auto_exit));

            enter.startAnimation(AnimationUtils.loadAnimation(this, R.anim.photo_auto_enter));

    }

    //调用的地方

    private Handler handler = new Handler(){

                    @Override

                    public void handleMessage(Message msg) {

                            // TODO Auto-generated method stub

                            super.handleMessage(msg);

                            switch(msg.what){

                            case START:

                                    position = photo_scanner_gallery.getSelectedItemPosition();

                                    if(position == photoList.size()-1){

                                            if(scanModel == ORDER){

                                                    removeMessages(START);

                                                    sendEmptyMessage(STOP);

                                                    break;

                                            }

                                    }

                                    imageViewAniamtion(position);

                                    if(position < photoList.size()-1){

                                            position++;

                                    }else{

                                            position = 0;

                                    }

    //                                setCurrentPosition(position);

                                    sendEmptyMessageDelayed(START, 5000);

                                    break;

                            case STOP:

                                    break;

                            default:

                                    break;

                            }

                            setCurrentPosition(position);

                            

                    }

            };

    方法2:

    gallery中直接使用 xxxx.onKeyDown(KeyEvent.KEYCODE_DPAD_RIGHT, null);

  • 相关阅读:
    POJ 2923 Relocation (状态压缩,01背包)
    HDU 2126 Buy the souvenirs (01背包,输出方案数)
    hdu 2639 Bone Collector II (01背包,求第k优解)
    UVA 562 Dividing coins (01背包)
    POJ 3437 Tree Grafting
    Light OJ 1095 Arrange the Numbers(容斥)
    BZOJ 1560 火星藏宝图(DP)
    POJ 3675 Telescope
    POJ 2986 A Triangle and a Circle
    BZOJ 1040 骑士
  • 原文地址:https://www.cnblogs.com/feitianlee/p/4241707.html
Copyright © 2011-2022 走看看