【发布时间】:2011-04-16 15:57:38
【问题描述】:
我使用Layout_width="fill_parent"和Layout_height="wrap content"。如果图像大于ImageView,它将完美缩小。
但是,我从来没有使用它来放大较小的图像。我尝试了ScaleType 和“AdjustViewBounds”的任意组合:它始终在图像视图的中间保持自己的大小。这是代码...
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_height="wrap_content"
android:background="@drawable/content_bg"
android:orientation="vertical"
android:padding="5dp"
android:layout_width="fill_parent"
android:layout_marginLeft="1px">
<ImageView
android:layout_height="wrap_content"
android:src="@drawable/test"
android:id="@+id/ImageViewTest"
android:layout_width="fill_parent"
android:adjustViewBounds="true"
android:scaleType="center"></ImageView>
</LinearLayout>
【问题讨论】:
-
尝试使用 CENTER_INSIDE 或 FIT_XY。
-
我都试过了。它们都不适合我。
-
我发现让它工作的唯一方法是将 layout_hight 和 layout_width 设置为固定值,例如 150dp x 200dp
-
我无法再测试给定的答案,因为我停止开发 Android 应用程序。请建议我是否应该将答案标记为完成,如果您已对其进行测试并符合我的问题的要求。
标签: android imageview android-layout android-image