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

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

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

View.isClickable介绍

暂无

代码示例

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

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

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

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

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

@Test
public void shouldClickAndNotClick() throws Exception {
 assertThat(view.isClickable()).isFalse();
 view.setClickable(true);
 assertThat(view.isClickable()).isTrue();
 view.setClickable(false);
 assertThat(view.isClickable()).isFalse();
 view.setOnClickListener(new OnClickListener() {
  @Override
  public void onClick(View v) {
   ;
  }
 });
 assertThat(view.isClickable()).isTrue();
}

代码示例来源: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: eleme/UETool

items.add(new TextItem("Id", Util.getResId(view)));
items.add(new TextItem("ResName", Util.getResourceName(view.getId())));
items.add(new TextItem("Clickable", Boolean.toString(view.isClickable()).toUpperCase()));
items.add(new TextItem("Focused", Boolean.toString(view.isFocused()).toUpperCase()));
items.add(new AddMinusEditItem("Width(dp)", element, EditTextItem.Type.TYPE_WIDTH, px2dip(view.getWidth())));

代码示例来源:origin: tumblr/Backboard

if (v.isClickable()) {
  if (event.getEventTime() - event.getDownTime()
      > ViewConfiguration.getLongPressTimeout()) {

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

final View view = (View) mBaseContent;
if (view.isClickable()) {
 mMountViewFlags |= FLAG_VIEW_CLICKABLE;

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

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

代码示例来源:origin: stackoverflow.com

ToggleButton toggle = ...
toggle.setOnTouchListener(new ToggleButton.OnTouchListener() {

 @Override
 public boolean onTouch(View v, MotionEvent event) {
   // If true is returned, the event is eated by the TouchListener
   return !v.isClickable();
 }
});

代码示例来源:origin: jeasonlzy/HeaderViewPager

@Override
protected void onFinishInflate() {
  super.onFinishInflate();
  if (mHeadView != null && !mHeadView.isClickable()) {
    mHeadView.setClickable(true);
  }
}

代码示例来源:origin: Vegen/SmartCampus

public void hideTopView() {
  if (!topView.isClickable()) {
    return;
  }
  AnimationUtils.hideToBottom(topView);
  topView.setClickable(false);
}

代码示例来源:origin: colinNaive/RecyclerViewScrollView

@Override
protected void onFinishInflate() {
  super.onFinishInflate();
  if (mHeadView != null && !mHeadView.isClickable()) {
    mHeadView.setClickable(true);
  }
}

代码示例来源:origin: Vegen/SmartCampus

public void showTopView() {
  if (topView.isClickable()) {
    return;
  }
  AnimationUtils.showFromBottom(topView);
  topView.setVisibility(View.VISIBLE);
  topView.setClickable(true);
}

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

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

代码示例来源:origin: ShonLin/QuickDevFramework

public void setLoadingView(View loadingView) {
  this.removeView(this.loadingView);
  this.loadingView = loadingView;
  this.addView(this.loadingView, INDEX_LOADING);
  this.loadingView.setVisibility(View.GONE);
  if (!this.loadingView.isClickable()) {
    this.loadingView.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View view) {}
    });
  }
}

代码示例来源:origin: ShonLin/QuickDevFramework

public void setEmptyView(View emptyView) {
  this.removeView(this.emptyView);
  this.emptyView = emptyView;
  this.addView(this.emptyView, INDEX_EMPTY);
  this.emptyView.setVisibility(View.GONE);
  if (!this.emptyView.isClickable()) {
    this.emptyView.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View view) {}   //如果本身没有设置监听则设置一个空的监听来防止误触
    });
  }
}

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

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

代码示例来源:origin: HpWens/MeiWidgetView

public RadiusViewDelegate(View view, Context context, AttributeSet attrs) {
  this.mView = view;
  this.mContext = context;
  this.mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.RadiusSwitch);
  this.mResourceUtil = new ResourceUtil(context);
  initAttributes(context, attrs);
  if (!(view instanceof CompoundButton) && !view.isClickable()) {
    view.setClickable(true);
  }
  view.setSelected(mSelected);
  setSelected(mSelected);
}

代码示例来源: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: ymback/NGA-CLIENT-VER-OPEN-SOURCE

@Override
  public void onSuccess(String data) {
    showToast(data);
    board.setChecked(v.isClickable());
    setResult(Activity.RESULT_OK);
  }
};

相关文章

微信公众号

最新文章

更多

View类方法