Pre*_*oid 5 android json image
我想在android中将图像显示为幻灯片放映.该图像将以json数据格式来自服务器.你能告诉我如何在显示图像的图像滑块中传递图像.在json中来自服务器的图像数量,它是完全动态的,一组图像......
最初您需要做的是计算来自json的图像.当您获得所有图像时,您可以使用horizondal页面向用户显示它.它有助于在此链接中更改每次滑动中的图像.否则你可以使用两个框架,并可以设置两个动画,并像滑块一样显示它.我认为这段代码将帮助你.
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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1614 次 |
| 最近记录: |