我们已经构建了一个在线购物应用程序。Android Grdiview显示不正确
我们有两个gridview的布局。 第一个:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
android:paddingBottom="0dp"
tools:context=".HomeActivity">
<GridView
android:id="@+id/gridView"
android:numColumns="3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
</RelativeLayout>
,第二个用于每个gridview的细胞:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/singleCell"
android:layout_width="345px"
android:layout_height="400px"
android:background="#E6E6E6">
<ImageView
android:contentDescription="@string/hello_world"
android:id="@+id/profileImg"
android:layout_width="fill_parent"
android:layout_height="330px"
android:scaleType="fitXY"
android:layout_marginLeft="1px"
android:layout_marginTop="2px"/>
<TextView
android:id="@+id/friend_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Name"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginTop="340px"
android:layout_marginLeft="20px"
android:textSize="13sp">
</TextView>
</FrameLayout>
的问题是,在一些器件中,gridview的正确显示像这样,比例是确定。
gridview is displayed correctly on some devices
但在其它几个装置,被不正确地显示的图像的高度和比的变化和图像。
gridview is displayed incorrectly on some devices
如果你给我们一个解决方案,帮助我们,我们会很高兴。这是一个关键问题,因为网格单元图像高度在某些设备中变化并变得更长。
Thanks @ nazmul-hasan-masum。我们测试你的解决方案现在比例更好,但问题在于,图像左侧和右侧的一部分不会显示在之前存在问题的设备中。将[旧版本](http://i.stack.imgur.com/uWKTx.jpg)与[您提供的解决方案](http://uploads.im/BH9SY.jpg)进行比较。正如你所看到的,现在图像比例看起来更好,但是左右的每个单元格的一部分都会被裁剪掉,并且它不应该被裁剪。 –