我有一个TableLayout和3个TableRows,每个TableRow有3个ImageViews。每个ImageView都有适合Scale的fitCenter,以及每个此计算器的重量和宽度answer。现在所有的图像都可以缩放以适应该行,但每行都需要更高。下面是XML的摘录:TableRow高度越来越差
<TableLayout android:id="@+id/TableLayout01"
android:layout_height="wrap_content"
android:padding="10dip"
android:stretchColumns="0,1,2"
android:shrinkColumns="0,1,2"
android:layout_weight="1"
android:layout_width="wrap_content">
<TableRow android:id="@+id/TableRow01"
android:layout_width="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:baselineAligned="false"
android:gravity="center_vertical|center_horizontal"
android:layout_height="wrap_content">
<ImageView android:id="@+id/image1"
android:src="@drawable/avocado3"
android:scaleType="fitCenter"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<ImageView android:id="@+id/image2"
android:src="@drawable/avocado3"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:scaleType="fitCenter"/>
<ImageView android:id="@+id/image3"
android:src="@drawable/avocado3"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:scaleType="fitCenter"/>
</TableRow>
...
</TableLayout>
而这里的第一行:
和第一行的结束和第二的开始:
ImageViews被设置为一个很小的绘图(@ drawable/avocado3),并且在activity的onCreate()中它获取了9张图像f从互联网rom并调用setImageBitmap()。
任何人有什么想法我做错了什么?
甜! adjustViewBounds做到了!非常感谢。在调用setImageBitmap()之前,我刚做了一些其他工作来缩放图像。有时间采取这种手段。 – chad 2010-11-12 16:19:30