朋友的 我有一个任务来解析缩略图并将其设置在网格视图上,其中url图像内容将在不同的高度和宽度(一些图像为60 * 60 ,或110 * 80),我如何设置网格中的图像具有统一的高度和宽度。如何设置网格图像具有统一的高度和宽度
在此先感谢。
朋友的 我有一个任务来解析缩略图并将其设置在网格视图上,其中url图像内容将在不同的高度和宽度(一些图像为60 * 60 ,或110 * 80),我如何设置网格中的图像具有统一的高度和宽度。如何设置网格图像具有统一的高度和宽度
在此先感谢。
给您的用于由ListAdapter创建一个固定的宽度和高度足够使最大尺寸的观点布局,然后定位内部例如为中心的ImageView的:
<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="100dip"
android:layout_height="80dip"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerInside">
</ImageView>
</RelativeLayout>
给您的布局由ListAdapter创建的视图一个固定的宽度和高度足以最大的尺寸,然后放置内如为中心的ImageView的:
<GridView
android:id="@+id/gridView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="4dp"
android:columnWidth="100dp"
android:horizontalSpacing="10dp"
android:verticalSpacing="10dp"
android:gravity="center"
android:numColumns="10"
android:stretchMode="columnWidth"/>
非常感谢您的回答,这对我非常有帮助 – 2016-03-22 05:41:21
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/seatLegendLayout">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearLayout_gridtableLayout"
android:layout_width="900dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<GridView
android:id="@+id/gridView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="4dp"
android:columnWidth="100dp"
android:gravity="center"
android:numColumns="9"
android:horizontalSpacing="1dp"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="horizontal"
android:stretchMode="none"
android:verticalSpacing="1dp">
</GridView>
</LinearLayout>
</FrameLayout>
</HorizontalScrollView>
对我来说,好的回答非常糟糕 – 2016-03-23 13:05:52
非常感谢..你的答案,我真的得到了查看我需要你的帮助。 – MGSenthil 2010-08-25 18:28:44