仅向左和向右滑动检测

时间:2019-02-26 20:39:24

标签: javascript java android

我有以下代码:

 public static Bitmap decodeSampledBitmapFromPath(String filepath, int reqWidth, int reqHeight) throws FileNotFoundException {


    final BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeFile(filepath);

    options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);

    options.inJustDecodeBounds = false;
    return Bitmap.createScaledBitmap(BitmapFactory.decodeFile(filepath),
            reqWidth, reqHeight, false);
}

我正在尝试使其在向下滑动时不执行“向右滑动”的逻辑,而在向上滑动时不执行“向右滑动”的逻辑。我只希望分别对“向右滑动”逻辑和“向左滑动”逻辑进行左右检测。现在,当我向上滑动时,它也在执行“向右滑动”逻辑;当我向下滑动时,它也在进行“向左滑动”逻辑。

任何有关如何更改此代码来避免这种情况的帮助吗?

0 个答案:

没有答案
相关问题