且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

图片幻灯机器人

更新时间:2023-11-19 12:34:28

Intially你需要做的是采取从你的所有图像的json.As传来的图像的数量,你可以使用horizo​​ndal显示给用户pages.It有助于改变图像中的每个刷卡像这样link 。否则,你可以用两帧,可以设置两个动画,并显示它像一个slider.I觉得这块code可以帮助你。

Intially you need to do is to take the count of the images coming from the json.As you get all the images you can show it to user using the horizondal pages.It helps to change the image in each swipe like in this link .Otherwise you can use two frames and can set two animations and show it like an slider.I think this piece of code will help you.

if (imagesetflag == true) {
                Right_to_left_in = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_in);
                Right_to_left_out = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_out);
                left_to_Right_in = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_in);
                Left_to_Right_out = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_out);

                frame1.setImageBitmapReset(decryptedimage, 0, true);
                TVpagenum.setText("Page no:" + Currentpage + "/"
                        + countOfPages);
                frame1.bringToFront();
                frame1.setVisibility(View.VISIBLE);
                frame2.setVisibility(View.INVISIBLE);
                frame1.setAnimation(Right_to_left_in);
                frame2.setAnimation(Right_to_left_out);                                     
                imagesetflag = false;
            } else {
                Right_to_left_in = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_in);
                Right_to_left_out = AnimationUtils.loadAnimation(this,
                        R.anim.right_to_left_out);
                left_to_Right_in = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_in);
                Left_to_Right_out = AnimationUtils.loadAnimation(this,
                        R.anim.left_to_right_out);

                frame2.setImageBitmapReset(decryptedimage, 0, true);
                TVpagenum.setText("Page no:" + Currentpage + "/"
                        + countOfPages);
                frame2.bringToFront();
                frame2.setVisibility(View.VISIBLE);
                frame1.setVisibility(View.INVISIBLE);
                frame2.setAnimation(Right_to_left_in);
                frame1.setAnimation(Right_to_left_out);                 
                imagesetflag = true;
            }