我正在使用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"
的组合,但都没有成功。