0

Mono-For-Droid を使用しています。を持っていて、ImageViewタッチすると指に追従し、指を離すと動きが止まるように動かしたい。

これが私のコードです。どうすればよいですか?

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.Views;
using Android.Widget;
using Android.Util;
using Android.Graphics.Drawables;
using Android.Content.Res;


[assembly: UsesPermission(Name = Android.Manifest.Permission.SystemAlertWindow)]
namespace ExtremeKeyboard
{
    [Service]
    public class ChatheadService: Android.App.Service
    {
        System.Threading.Timer _timer;

        private IWindowManager windowManager;
        private ImageView ReminderHead;
        private Drawable icon;
        private Android.Views.WindowManagerLayoutParams LOParams;

        public override void OnStart(Android.Content.Intent intent, int startId)
        {
            base.OnStart(intent, startId);

            var windowService = this.GetSystemService(Android.Content.Context.WindowService);
            var windowManager = windowService.JavaCast<Android.Views.IWindowManager>();

            ReminderHead = new ImageView(this);
            ReminderHead.SetImageResource(Resource.Drawable.Icon);

            LOParams = new Android.Views.WindowManagerLayoutParams(
                Android.Views.WindowManagerLayoutParams.WrapContent,
                Android.Views.WindowManagerLayoutParams.WrapContent,
                Android.Views.WindowManagerTypes.Phone,
                Android.Views.WindowManagerFlags.NotFocusable,
                Android.Graphics.Format.Translucent);
            LOParams.Gravity = GravityFlags.Top | GravityFlags.Left;
            LOParams.X = 0;
            LOParams.Y = 100;            

            windowManager.AddView(ReminderHead, LOParams);
        }

        public override Android.OS.IBinder OnBind(Android.Content.Intent intent)
        {
            throw new NotImplementedException();
        }       
    }
}
4

0 に答える 0