当前位置: 代码迷 >> Android >> 网格视图图像错误
  详细解决方案

网格视图图像错误

热度:62   发布时间:2023-08-04 12:33:13.0

你好,我是android新手。 请帮忙。

我的SingleViewActivity Java

package com.example.helloworld;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;

public class SingleViewActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
  super.onCreate(savedInstanceState);  
  setContentView(R.layout.single_view);

  // Get intent 
  Intent i = getIntent();

  // Selected image id
  int position = i.getExtras().getInt("id");
  ImageAdapter imageAdapter = new ImageAdapter(this);

  ImageView imageView =(ImageView) findViewById(R.id.SingleView);   
  imageView.setImageResource(imageAdapter.mThumbIds[position]);}}

这个单视图xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageViewandroid:id="@+id/SingleView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>
</LinearLayout>

所以我的问题是,当单击拇指图像时未显示完整图像

对不起,我的英语不好

像这样向ImageView添加比例类型,

android:scaleType="fitXY"
  相关解决方案