图片幻灯机器人 [英] Images slide show in android

查看:114
本文介绍了图片幻灯机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示图像,幻灯片播放的机器人。该图像将来自于JSON数据格式的服务器。你能告诉我怎样才能通过,在图像滑块将显示的图像。图像从JSON服务器端传来的数量,这是完全动态的,一组图像...

I want to show images as slide show in android. That images will come from the server in the json data format. Can you tell me how i can pass that images in the images slider that will display the images. number of images coming from the server in json, it is totally dynamic, a group of images...

推荐答案

Intially你需要做的是采取从你的所有图像的json.As传来的图像的数量,你可以使用horizo​​ndal显示给用户pages.It有助于改变图像中的每个刷卡像这样<一个href="http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-horizontal-view-paging/">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;
            }

这篇关于图片幻灯机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆