【问题标题】:ImageView adjustViewBounds does not work properly on Xamarin.AndroidImageView adjustViewBounds 在 Xamarin.Android 上无法正常工作
【发布时间】:2017-02-20 21:36:21
【问题描述】:

我在 ImageView 上使用了 adjustViewBounds 属性,例如:

<ImageView
android:id="@+id/rotImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="true"
android:layout_alignParentTop="false"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:maxHeight="60dp"
android:maxWidth="60dp"
android:adjustViewBounds="true" />

我将 ImageView 设置如下:

Bitmap image = Base64Converter.Base64ToBitmap(stringimage);
imageview.SetImageBitmap(image);

我的问题是我的 ImageView 是空的,只是白色的。 如果我删除了 adjustViewBounds 属性,图像会显示,但不是我希望的那样。

我的 Xamarin 版本:最后一个稳定版 (4.2.2.11)

【问题讨论】:

    标签: android xamarin xamarin.android android-imageview


    【解决方案1】:

    adjustViewBounds 可能无法很好地配合您的布局。我会尝试使用 scaleType,我会开始尝试 FIT_CENTER,但这取决于您想要实现的目标。

    【讨论】:

    • 我尝试使用 scaleType。这不是我想要的,但我必须使用一些黑客来获得我想要的东西,谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-01
    相关资源
    最近更新 更多