【发布时间】:2016-01-17 12:46:00
【问题描述】:
我正在 Xamarin 上开发一个移动应用程序。
在应用程序中,ImageView 显示的图像太小,无法适应屏幕的宽度。
我想缩放图像以适应屏幕宽度,同时保持纵横比。
我的axml
<LinearLayout
android:id="@+id/overlayImageContainer"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/overlayImageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="fitCenter"/>
</LinearLayout>
结果
两个 ImageView 显示 a) 比屏幕宽度宽的图片和 b) 比屏幕宽度窄的图片
我尝试了android:scaleType 和android:adjustViewBounds="true" 的各种组合,但均未成功。
【问题讨论】: