Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中显示图像的listview_Android_Android Listview - Fatal编程技术网

在android中显示图像的listview

在android中显示图像的listview,android,android-listview,Android,Android Listview,我有一个android的listview和一个imageview 我正在将图像填充到列表视图中,我的输出如下所示: listview\u item.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" andro

我有一个android的listview和一个imageview

我正在将图像填充到列表视图中,我的输出如下所示:

listview\u item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:descendantFocusability="blocksDescendants" >

        <ImageView
            android:id="@+id/flag"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:src="@drawable/ic_launcher" />

</RelativeLayout>

我怎样才能做出下面这样的东西


任何想法。。。我试图在列表视图中实现这一点

scaleType
添加到ImageView

<ImageView
   android:id="@+id/flag"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:layout_alignParentLeft="true"
   android:layout_alignParentRight="true"
   android:src="@drawable/ic_launcher" 
   android:scaleType="fitXY"/>

在xml中设置android:adjustViewBounds=“true”属性,或在Java中设置
imageView.setAdjustViewBounds(true)

您可以在XML中使用android:scaleType=“fitXY”:

<ImageView
    android:id="@+id/flag"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:scaleType="fitXY"
    android:src="@drawable/ic_launcher" />


Android提供了许多选项来使用ImageView

您可以在案例中使用adjustViewBounds和scaleType属性。检查下面的示例:

<ImageView
    android:id="@+id/flag"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:scaleType="fitXY"
    android:adjustViewBounds="true"
    android:src="@drawable/ic_launcher" />


检查下面我的答案:
android:scaleType=“fitXY”
放入有助于。。。。我得到了我想要的。。。。。但是高度。。。它仍然是一个小。。。。行高大小…可以使用android:layout\u height=“100dp”