android.view.View.isLongClickable()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(218)

本文整理了Java中android.view.View.isLongClickable()方法的一些代码示例,展示了View.isLongClickable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.isLongClickable()方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:isLongClickable

View.isLongClickable介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public S isNotLongClickable() {
 isNotNull();
 assertThat(actual.isLongClickable()) //
   .overridingErrorMessage("Expected to not be long-clickable but was") //
   .isFalse();
 return myself;
}

代码示例来源:origin: square/assertj-android

public S isLongClickable() {
 isNotNull();
 assertThat(actual.isLongClickable()) //
   .overridingErrorMessage("Expected to be long-clickable but was not") //
   .isTrue();
 return myself;
}

代码示例来源:origin: balysv/material-ripple

private boolean findClickableViewInChild(View view, int x, int y) {
  if (view instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup) view;
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      View child = viewGroup.getChildAt(i);
      final Rect rect = new Rect();
      child.getHitRect(rect);
      final boolean contains = rect.contains(x, y);
      if (contains) {
        return findClickableViewInChild(child, x - rect.left, y - rect.top);
      }
    }
  } else if (view != childView) {
    return (view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode()));
  }
  return view.isFocusableInTouchMode();
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldLongClickAndNotLongClick() throws Exception {
 assertThat(view.isLongClickable()).isFalse();
 view.setLongClickable(true);
 assertThat(view.isLongClickable()).isTrue();
 view.setLongClickable(false);
 assertThat(view.isLongClickable()).isFalse();
 view.setOnLongClickListener(new OnLongClickListener() {
  @Override
  public boolean onLongClick(View v) {
   return false;
  }
 });
 assertThat(view.isLongClickable()).isTrue();
}

代码示例来源:origin: facebook/litho

if (view.isLongClickable()) {
 mMountViewFlags |= FLAG_VIEW_LONG_CLICKABLE;

代码示例来源:origin: alexvasilkov/GestureViews

viewportEvent.offsetLocation(-view.getPaddingLeft(), -view.getPaddingTop());
gestureDetector.setIsLongpressEnabled(view.isLongClickable());

代码示例来源:origin: willowtreeapps/Hyperion-Android

attributes.add(new MutableBooleanViewAttribute("LongClickable", view.isLongClickable()) {
  @Override
  protected void mutate(Boolean value) {

代码示例来源:origin: klinker24/Android-Blur-Launcher

public boolean onPressed(MotionEvent event) {
  return mView.isLongClickable() && mView.performLongClick();
}

代码示例来源:origin: klinker24/launcher3

public boolean onPressed(MotionEvent event) {
  return mView.isLongClickable() && mView.performLongClick();
}

代码示例来源:origin: enricocid/LaunchEnr

public boolean onPressed(MotionEvent event) {
  return mView.isLongClickable() && mView.performLongClick();
}

代码示例来源:origin: appium/appium-espresso-driver

public boolean isLongClickable() {
  return view.isLongClickable();
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public S isLongClickable() {
 isNotNull();
 assertThat(actual.isLongClickable()) //
   .overridingErrorMessage("Expected to be long-clickable but was not") //
   .isTrue();
 return myself;
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public S isNotLongClickable() {
 isNotNull();
 assertThat(actual.isLongClickable()) //
   .overridingErrorMessage("Expected to not be long-clickable but was") //
   .isFalse();
 return myself;
}

代码示例来源:origin: com.google.android.apps.common.testing.accessibility.framework/accessibility-test-framework

/**
 * Determines if the supplied {@link View} is actionable for accessibility purposes.
 *
 * @param view The {@link View} to evaluate
 * @return {@code true} if {@code view} is considered actionable for accessibility
 */
public static boolean isActionableForAccessibility(View view) {
 if (view == null) {
  return false;
 }
 return (view.isClickable() || view.isLongClickable() || view.isFocusable());
}

代码示例来源:origin: WeAreFairphone/FP2-Launcher

public void onClick(View v) {
    if (mActionMode != null) {
      // When CAB is up, clicking toggles the item instead
      if (v.isLongClickable()) {
        mLongClickListener.onLongClick(v);
      }
      return;
    }
    mSetWallpaperButton.setEnabled(true);
    WallpaperTileInfo info = (WallpaperTileInfo) v.getTag();
    if (info.isSelectable() && v.getVisibility() == View.VISIBLE) {
      selectTile(v);
    }
    info.onClick(WallpaperPickerActivity.this);
  }
};

代码示例来源:origin: jjhesk/KickAssSlidingMenu

private boolean findClickableViewInChild(View view, int x, int y) {
  if (view instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup) view;
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      View child = viewGroup.getChildAt(i);
      final Rect rect = new Rect();
      child.getHitRect(rect);
      final boolean contains = rect.contains(x, y);
      if (contains) {
        return findClickableViewInChild(child, x - rect.left, y - rect.top);
      }
    }
  } else if (view != childView) {
    return (view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode()));
  }
  return view.isFocusableInTouchMode();
}

代码示例来源:origin: bzsome/VirtualApp-x326

private boolean findClickableViewInChild(View view, int x, int y) {
  if (view instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup) view;
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      View child = viewGroup.getChildAt(i);
      final Rect rect = new Rect();
      child.getHitRect(rect);
      final boolean contains = rect.contains(x, y);
      if (contains) {
        return findClickableViewInChild(child, x - rect.left, y - rect.top);
      }
    }
  } else if (view != childView) {
    return (view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode()));
  }
  return view.isFocusableInTouchMode();
}

代码示例来源:origin: fookwood/Launcher3

public void onClick(View v) {
    if (mActionMode != null) {
      // When CAB is up, clicking toggles the item instead
      if (v.isLongClickable()) {
        mLongClickListener.onLongClick(v);
      }
      return;
    }
    setWallpaperButtonEnabled(true);
    WallpaperTileInfo info = (WallpaperTileInfo) v.getTag();
    if (info.isSelectable() && v.getVisibility() == View.VISIBLE) {
      selectTile(v);
    }
    info.onClick(WallpaperPickerActivity.this);
  }
};

代码示例来源:origin: jjhesk/KickAssSlidingMenu

private boolean findClickableViewInChild(View view, int x, int y) {
  if (view instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup) view;
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      View child = viewGroup.getChildAt(i);
      final Rect rect = new Rect();
      child.getHitRect(rect);
      final boolean contains = rect.contains(x, y);
      if (contains) {
        return findClickableViewInChild(child, x - rect.left, y - rect.top);
      }
    }
  } else if (view != childView) {
    return (view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode()));
  }
  return view.isFocusableInTouchMode();
}

代码示例来源:origin: jjhesk/KickAssSlidingMenu

private boolean findClickableViewInChild(View view, int x, int y) {
  if (view instanceof ViewGroup) {
    ViewGroup viewGroup = (ViewGroup) view;
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
      View child = viewGroup.getChildAt(i);
      final Rect rect = new Rect();
      child.getHitRect(rect);
      final boolean contains = rect.contains(x, y);
      if (contains) {
        return findClickableViewInChild(child, x - rect.left, y - rect.top);
      }
    }
  } else if (view != childView) {
    return (view.isEnabled() && (view.isClickable() || view.isLongClickable() || view.isFocusableInTouchMode()));
  }
  return view.isFocusableInTouchMode();
}

相关文章

View类方法