移除ListView项之间的间距

3

我希望创建一个在Android中包含图片的ListView。

我希望这些图片在列表中紧挨在一起,但是我无法将它们排列在一起。

以下是我的listview.xml:

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

<ListView
    android:id="@id/android:list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:drawSelectorOnTop="false"
    android:divider="@android:color/transparent"
    android:dividerHeight="0.0px"
    android:padding="0dip"
    android:layout_margin="0dip"
/>

</LinearLayout>

以下是我的listrow.xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/vw01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">    

<ImageView android:id="@+id/img01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="0dip"
    android:layout_margin="0dip"/>

</LinearLayout>

你可以在这里看到我所说的间距: http://imgbucket.info/img/kad67sjsg/stackoverflow.png

这对我来说看起来不错。你确定你的图片中没有透明像素吗? - Janusz
我也觉得看起来没问题。这就是让我疯狂的原因 :) 我很确定没有透明像素。我使用的图像在这里:http://imgbucket.info/img/1dbvyxqvi/bluebrick.png - JacobOJ
我不确定,但你是否尝试将“minHeight=0dip”放置在列表行的线性布局中? - Christian
我没有。但它没有起作用。 - JacobOJ
你的布局XML帮助我消除了我的项目之间的黑色边框!谢谢。 - swinefeaster
1个回答

2

我解决了这个问题。

我将图片缩小,这就解决了问题,所以问题根本不在代码中。 感谢您的建议。


1
就像我所写的那样,问题并不在代码中。我使用图像编辑器将图像文件缩小了。 - JacobOJ
谢谢,这也帮助了我! - Aaron

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接