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);

  • 相关阅读:
    Java集合 使用Map
    Java集合 编写equals方法
    yiyou本地安装出现版本问题
    网站地图制作
    SEO小爬虫工具文章排版
    知名企业招聘技术员题库
    测试上网速度
    邮件传输协议软件
    JSONP跨域问题
    织梦搬家
  • 原文地址:https://www.cnblogs.com/feitianlee/p/4241707.html
Copyright © 2011-2022 走看看