2011-09-20 71 views
1

我有一个静态数组。将图像从数组加载到图像视图并使用鳍状肢显示下一个或上一个

private Integer[] mThumbIds = { 
     R.drawable.sample_0, R.drawable.sample_1, 
     R.drawable.sample_2, R.drawable.sample_3, 
     R.drawable.sample_4, R.drawable.sample_5, 
     R.drawable.sample_6, R.drawable.sample_7, 
     R.drawable.sample_0 
} 

现在我必须在图像视图中逐个显示这些图像,并在鳍状肢(或其他)的帮助下显示上一个或下一个图像。 第一个问题如何在图像视图中加载这些图像。 如果您可以提供一些示例代码,那对我来说很好。 谢谢。

+0

http://developer.android.com/resources/tutorials/views/hello-gallery.html –

回答

0

您可以像这样使用数组显示图像。

int id= mThumbIds[5]; 

youImageView.setBackgroundDrawable(getResources().getDrawable(id)) 
0

我在自定义图库视图的帮助下解决了这个问题。你可以在图库视图中使用图库视图适配器类,你应该给图像视图的高度和宽度fill_parent。

您可以创建自定义图库视图像how to stop scrolling gallery?

看到上面的链接,并做等。这将是有帮助的ü..

感谢&问候, MMRPs

相关问题