FFImageloading xamarin android fit to parent
我正在用mvvmcross框架在Xamarin中创建一个android应用程序。FFImageloading xamarin android fit to parent
我试图从服务器向我们的用户显示图片(图片是Url)。但这些图片拒绝按比例填充父母。 如何才能实现这些图像的正确配合? ,我使用宽度标签上的FillParent。但图像拒绝缩放到容器的大小。
我的当前设置
<FFImageLoading.Cross.MvxImageLoadingView
android:id="@+id/my_plannymap_listitem_title_picture"
android:layout_width="fill_parent"
android:layout_height="150dp"
local:MvxBind="DataLocationUri ImageUrl; Click OpenDetailCommand" />
上面的代码创建(抱歉体积的东西),正如你所看到的图像不补,他们仍然是他们的“原始”大小
其他活动(这里同样的问题)
<FFImageLoading.Cross.MvxImageLoadingView
android:layout_width="fill_parent"
android:layout_height="150dp"
android:scaleType="fitCenter"
android:id="@+id/overview_image"
android:background="#580AB0"
local:MvxBind="DataLocationUri ImageUrl"
TransparencyEnabled="false"
DownSampleToFit="true" />
这听起来像你要修复的高度150dp,并固定宽度父宽度。如果是这种情况,可以完成,但它会拉伸任何不正确的高宽比的图像。
<FFImageLoading.Cross.MvxImageLoadingView
android:id="@+id/my_plannymap_listitem_title_picture"
android:layout_width="match_parent"
android:layout_height="150dp"
android:scaleType="fitXY"
local:MvxBind="DataLocationUri ImageUrl; Click OpenDetailCommand" />
(注意我用match_parent
因为fill_parent
是deprecated)
如果你不想让你的图像在一个陌生的方式延伸,你不能保证进入的图像的长宽比匹配您需要选择一个方面(宽度或高度)来指定另一个方面的大小,以保持比例不变。 (从它基于图像的长宽比在这种情况下,你决定的宽度和高度测量),你可以做到这一点与以下:
<FFImageLoading.Cross.MvxImageLoadingView
android:id="@+id/my_plannymap_listitem_title_picture"
android:layout_width="match_parent"
android:layout_height="wrap_content"
local:MvxBind="DataLocationUri ImageUrl; Click OpenDetailCommand" />
在几乎所有情况下,你不能保证长宽比的缩放比例,第二个选项比第一个效果更好。
难道我没有办法裁剪/缩放图像以匹配150dp大小的高度的正确纵横比吗?见下文 http://i.imgur.com/uDAiBVE.jpg –
是有图像 - 使用第一个选项之上,但更换'“fitXY”'和'“中心”' –
好吧,这是什么我在寻找 ! ,非常感谢 –
我没有xamarin的任何经验,但在原生的Android,我们设置scaleType属性的来fitxy,所以我想应该有xamarin –
相同的属性..太感谢你了,不能只见树木不见森林。 –