xamarin'de özel görünümler tasarlamamı sağlayacak herhangi bir eğitim var mı? Xamarin kullanarak benim android uygulaması için tutam yakınlaştırma işlevselliği oluşturmak istiyorum.xamarin'de özel görünümler oluşturma
ben kod aşağıdaki denedi, ama onun değil çalışma, hep hata
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
using Android.Graphics;
namespace LA_Application
{
public class ZoomView : FrameLayout
{
private ScaleGestureDetector mScaleDetector;
private static float mScaleFactor = 1.0f;
public ZoomView (Context context) : base (context)
{
Initialize();
}
public ZoomView (Context context, IAttributeSet attrs) : base (context,attrs)
{
Initialize();
}
public ZoomView (Context context, IAttributeSet attrs, int defStyle) : base (context, attrs, defStyle)
{
Initialize();
}
void Initialize()
{
mScaleDetector = new ScaleGestureDetector(Context, new ScaleListener());
}
public override bool OnTouchEvent (MotionEvent e)
{
mScaleDetector.OnTouchEvent(e);
return true;
}
protected override void OnDraw(Android.Graphics.Canvas canvas)
{
base.OnDraw(canvas);
canvas.Save();
canvas.Scale(mScaleFactor, mScaleFactor);
canvas.Restore();
}
}
private class ScaleListener : ScaleGestureDetector.SimpleOnScaleGestureListener
{
public override bool OnScale(ScaleGestureDetector detector)
{
mScaleFactor *= detector.ScaleFactor;
// Don't let the object get too small or too large.
mScaleFactor = Math.Max(0.1f, Math.Min(mScaleFactor, 5.0f));
return true;
}
}
}
}
ve düzen dosyasında android.view.InflateException: Binary XML file line #1: Error inflating class LA_Application.ZoomView
alıyorum
<?xml version="1.0" encoding="utf-8"?>
<LA_Application.ZoomView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/my_view" />
aktivite kodu
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.zoomview);
/*some code*/
}
Xamarin'de oluşturulan hiçbir xml dosyası yok, sadece C# dosyası - herhangi bir fikir var mı? –