друга У меня есть задача разобрать миниатюрные изображения и установить его в виде сетки, где содержимое изображения 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>
<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>
Дайте вашему макету для представлений, созданных 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"/>