0
목록보기에서 스 와이프를 수행 할 수 있습니다. 나는 R -> R에서 스 와이프 할 때 한 색을 보여주고 싶습니다. R -> L에서 스 와이프하면 다른 색을 표현하고 싶습니다. 현재 나는 제스처를 식별하기 위해 아래와 같은 코드를 사용합니다.스 와이프에서 색상 변경
public class GestureListener : Java.Lang.Object, GestureDetector.IOnGestureListener
{
public delegate void SwipeLeftEventHandler(MotionEvent first, MotionEvent second);
public event SwipeLeftEventHandler SwipeLeftEvent;
public delegate void SwipeRightEvetnHandler(MotionEvent first, MotionEvent second);
public event SwipeRightEvetnHandler SwipeRightEvent;
//public event Action LeftEvent;
//public event Action RightEvent;
private static int SWIPE_MAX_OFF_PATH = 300;
private static int SWIPE_MIN_DISTANCE = 100;
private static int SWIPE_THRESHOLD_VELOCITY = 10;
public GestureListener()
{
}
public bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
try
{
if (Math.Abs(e1.GetY() - e2.GetY()) > SWIPE_MAX_OFF_PATH)
return false;
// right to left swipe
if (e1.GetX() - e2.GetX() > SWIPE_MIN_DISTANCE && Math.Abs(velocityX) > SWIPE_THRESHOLD_VELOCITY && SwipeLeftEvent /*LeftEvent*/ != null)
SwipeLeftEvent(e1, e2); //LeftEvent(); //Toast.MakeText(view.Context, "Left Swipe", ToastLength.Short).Show();
else if (e2.GetX() - e1.GetX() > SWIPE_MIN_DISTANCE && Math.Abs(velocityX) > SWIPE_THRESHOLD_VELOCITY && SwipeRightEvent /*RightEvent*/ != null)
SwipeRightEvent(e1, e2); //RightEvent(); // Toast.MakeText(view.Context, "Right Swipe", ToastLength.Short).Show();
}
catch (Exception e)
{
// nothing
}
return false;
}
public bool OnDown(MotionEvent e)
{
return true;
}
public void OnLongPress(MotionEvent e)
{
}
public bool OnScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
{
return true;
}
public void OnShowPress(MotionEvent e)
{
}
public bool OnSingleTapUp(MotionEvent e)
{
return true;
}
}
색상 표시 위치? 전체 목록 색상을 변경하고 있습니까? 목록 항목 만 변경 하시겠습니까? 귀하가 게시 한 코드는 어떤 요소에 대한 색상 변경 시도를 나타내지 않으므로 현재 게시 한 항목으로 이동하기가 어렵습니다. – CodyEngel
목록보기에서 행의 색상을 변경하려면 스 와이프 행동이 발생합니다. 내가 게시 한 코드는 어느 행이 스 와이프되었는지 식별 할 수있는 지점에 있습니다. – Krishna