2012-01-17 85 views
0

我有一个画廊(此画廊混合了一些嵌入式组件,用于展示一些缩略图)。我想要做的是,每当用户点击任何图片时应该全屏显示图片。请帮助我解决这个问题。如何从画廊中显示图片

回答

1

您可以将此图片传递到Gallery并让其显示此图像。

望着画廊清单:

<activity android:name="com.android.camera.ImageGallery" 
       android:label="@string/gallery_label" 
       android:configChanges="orientation|keyboardHidden" 
       android:icon="@drawable/ic_launcher_gallery"> 
      <intent-filter> 
       <action android:name="android.intent.action.VIEW" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <data android:mimeType="vnd.android.cursor.dir/image" /> 
      </intent-filter> 
</activity> 

有了这个信息是明确的,你可以与ACTION_VIEW的意图传递并设置数据作为图像,它可以是一个URI可能是像“文件:/”。然后,当开始这个意图时,您可能需要startActivityForResult(),以便应用程序可以返回给您。请参阅图库源代码。

0

为您传递到画廊的ImageView你可以做

ImageView i; 
i.setAdjustViewBounds(true); 
//also, you shoudn't use hardcoded pixel values (in 
i.setLayoutParams(new Gallery.LayoutParams(400, 300));)