在Xamarin中,如何为图像启用捏合缩放是最佳方式?目前我只有一个ImageView,其中包含一个Bitmap图像。
我做了一些研究,并找到了一些人使用其他库的示例,但在开始编写此代码之前,想了解在Android中特别是Xamarin中启用图像捏合缩放的最佳方法是什么。
提前感谢。
我做了一些研究,并找到了一些人使用其他库的示例,但在开始编写此代码之前,想了解在Android中特别是Xamarin中启用图像捏合缩放的最佳方法是什么。
提前感谢。
namespace Samples
{
[Activity(Label = "My Activity")]
public class ScaleImageActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.ScaleImage);
}
}
}
接着,通过创建以下XML布局并添加ScaleImage.axml布局来完成:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.refractored.monodroidtoolkit.ScaleImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/seattle"
android:id="@+id/AnimateImage">
</com.refractored.monodroidtoolkit.ScaleImageView>
</LinearLayout>
最后,在这个示例中,它正在从drawable文件夹加载西雅图的图像,因此请添加可以在这里找到的seattle.jpg图像。
MonoDroidToolkit有一个包含许多示例的项目,包括此示例。