android.text.Selection.removeSelection()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(144)

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

Selection.removeSelection介绍

暂无

代码示例

代码示例来源:origin: seven332/EhViewer

@Override
public void initialize(TextView widget, Spannable text) {
  Selection.removeSelection(text);
  text.removeSpan(FROM_BELOW);
}

代码示例来源:origin: seven332/EhViewer

@Override
public void onTakeFocus(TextView view, Spannable text, int dir) {
  Selection.removeSelection(text);
  if ((dir & View.FOCUS_BACKWARD) != 0) {
    text.setSpan(FROM_BELOW, 0, 0, Spannable.SPAN_POINT_POINT);
  } else {
    text.removeSpan(FROM_BELOW);
  }
}

代码示例来源:origin: nickbutcher/plaid

@Override
public boolean onTouchEvent(TextView textView, Spannable spannable, MotionEvent event) {
  boolean handled = false;
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    pressedSpan = getPressedSpan(textView, spannable, event);
    if (pressedSpan != null) {
      pressedSpan.setPressed(true);
      Selection.setSelection(spannable, spannable.getSpanStart(pressedSpan),
          spannable.getSpanEnd(pressedSpan));
      handled = true;
    }
  } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
    TouchableUrlSpan touchedSpan = getPressedSpan(textView, spannable, event);
    if (pressedSpan != null && touchedSpan != pressedSpan) {
      pressedSpan.setPressed(false);
      pressedSpan = null;
      Selection.removeSelection(spannable);
    }
  } else {
    if (pressedSpan != null) {
      pressedSpan.setPressed(false);
      super.onTouchEvent(textView, spannable, event);
      handled = true;
    }
    pressedSpan = null;
    Selection.removeSelection(spannable);
  }
  return handled;
}

代码示例来源:origin: seven332/EhViewer

Selection.removeSelection(buffer);

代码示例来源:origin: PrivacyApps/html-textview

Selection.removeSelection(buffer);
Touch.onTouchEvent(widget, buffer, event);
return false;

代码示例来源:origin: jaydenxiao2016/AndroidFire

Selection.removeSelection(buffer);
  widget.setBackgroundResource(DEFAULT_COLOR);
}else if(action == MotionEvent.ACTION_MOVE){

代码示例来源:origin: Naoki2015/CircleDemo

Selection.removeSelection(buffer);
  widget.setBackgroundResource(R.color.transparent);
}else if(action == MotionEvent.ACTION_MOVE){

代码示例来源:origin: armcha/AutoLinkTextView

@Override
public boolean onTouchEvent(TextView textView, final Spannable spannable, MotionEvent event) {
  int action  = event.getAction();
  if (action == MotionEvent.ACTION_DOWN) {
    pressedSpan = getPressedSpan(textView, spannable, event);
    if (pressedSpan != null) {
      pressedSpan.setPressed(true);
      Selection.setSelection(spannable, spannable.getSpanStart(pressedSpan),
          spannable.getSpanEnd(pressedSpan));
    }
  } else if (action == MotionEvent.ACTION_MOVE) {
    TouchableSpan touchedSpan = getPressedSpan(textView, spannable, event);
    if (pressedSpan != null && touchedSpan != pressedSpan) {
      pressedSpan.setPressed(false);
      pressedSpan = null;
      Selection.removeSelection(spannable);
    }
  } else {
    if (pressedSpan != null) {
      pressedSpan.setPressed(false);
      super.onTouchEvent(textView, spannable, event);
    }
    pressedSpan = null;
    Selection.removeSelection(spannable);
  }
  return true;
}

代码示例来源:origin: andforce/iBeebo

@Override
public void initialize(TextView widget, Spannable text) {
  Selection.removeSelection(text);
  text.removeSpan(FROM_BELOW);
}

代码示例来源:origin: zhe525069676/WeiBoLayout

@Override
public void initialize(TextView widget, Spannable text) {
  Selection.removeSelection(text);
  text.removeSpan(FROM_BELOW);
}

代码示例来源:origin: dongorigin/AndroidDemo

@Override
  public boolean onLongClick(View v) {
    T.shortT(mContext, "long click");
    Selection.removeSelection(((Spannable) mText2View.getText()));
    return true;
  }
});

代码示例来源:origin: andforce/iBeebo

@Override
public void onTakeFocus(@NonNull TextView view, Spannable text, int dir) {
  Selection.removeSelection(text);
  if ((dir & View.FOCUS_BACKWARD) != 0) {
    text.setSpan(FROM_BELOW, 0, 0, Spannable.SPAN_POINT_POINT);
  } else {
    text.removeSpan(FROM_BELOW);
  }
}

代码示例来源:origin: zhe525069676/WeiBoLayout

@Override
public void onTakeFocus(TextView view, Spannable text, int dir) {
  Selection.removeSelection(text);
  if ((dir & View.FOCUS_BACKWARD) != 0) {
    text.setSpan(FROM_BELOW, 0, 0, Spannable.SPAN_POINT_POINT);
  } else {
    text.removeSpan(FROM_BELOW);
  }
}

代码示例来源:origin: KCrason/HighPerformanceFriendsCircle

mTextClickSpan.setPressed(false);
mTextClickSpan = null;
Selection.removeSelection(buffer);
mTextClickSpan.setPressed(false);
mTextClickSpan = null;
Selection.removeSelection(buffer);

代码示例来源:origin: Carbs0126/ExpandableTextView

@Override
public boolean onTouchEvent(TextView textView, Spannable spannable, MotionEvent event) {
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    mPressedSpan = getPressedSpan(textView, spannable, event);
    if (mPressedSpan != null) {
      mPressedSpan.setPressed(true);
      Selection.setSelection(spannable, spannable.getSpanStart(mPressedSpan),
          spannable.getSpanEnd(mPressedSpan));
    }
  } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
    TouchableSpan touchedSpan = getPressedSpan(textView, spannable, event);
    if (mPressedSpan != null && touchedSpan != mPressedSpan) {
      mPressedSpan.setPressed(false);
      mPressedSpan = null;
      Selection.removeSelection(spannable);
    }
  } else {
    if (mPressedSpan != null) {
      mPressedSpan.setPressed(false);
      super.onTouchEvent(textView, spannable, event);
    }
    mPressedSpan = null;
    Selection.removeSelection(spannable);
  }
  return true;
}

代码示例来源:origin: ImangazalievM/Bubbble

@Override
public boolean onTouchEvent(TextView textView, Spannable spannable, MotionEvent event) {
  boolean handled = false;
  if (event.getAction() == MotionEvent.ACTION_DOWN) {
    pressedSpan = getPressedSpan(textView, spannable, event);
    if (pressedSpan != null) {
      pressedSpan.setPressed(true);
      Selection.setSelection(spannable, spannable.getSpanStart(pressedSpan),
          spannable.getSpanEnd(pressedSpan));
      handled = true;
    }
  } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
    TouchableUrlSpan touchedSpan = getPressedSpan(textView, spannable, event);
    if (pressedSpan != null && touchedSpan != pressedSpan) {
      pressedSpan.setPressed(false);
      pressedSpan = null;
      Selection.removeSelection(spannable);
    }
  } else {
    if (pressedSpan != null) {
      pressedSpan.setPressed(false);
      super.onTouchEvent(textView, spannable, event);
      handled = true;
    }
    pressedSpan = null;
    Selection.removeSelection(spannable);
  }
  return handled;
}

代码示例来源:origin: tylersuehr7/social-text-view

@Override
public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
  switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
      pressedSpan = getTouchedSpan(widget, buffer, event);
      if (pressedSpan != null) {
        pressedSpan.setPressed(true);
        Selection.setSelection(buffer, buffer.getSpanStart(pressedSpan), buffer.getSpanEnd(pressedSpan));
      }
      break;
    case MotionEvent.ACTION_MOVE:
      TouchableSpan pressedSpan2 = getTouchedSpan(widget, buffer, event);
      if (pressedSpan != null && pressedSpan2 != pressedSpan) {
        pressedSpan.setPressed(false);
        pressedSpan = null;
        Selection.removeSelection(buffer);
      }
      break;
    default:
      if (pressedSpan != null) {
        pressedSpan.setPressed(false);
        super.onTouchEvent(widget, buffer, event);
      }
      pressedSpan = null;
      Selection.removeSelection(buffer);
      break;
  }
  return true;
}

代码示例来源:origin: pkhope/weibo

Selection.removeSelection(buffer);
      Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  Selection.removeSelection(buffer);
Selection.removeSelection(buffer);

代码示例来源:origin: adgvcxz/Dribbble-MVVM

Selection.removeSelection(buffer);
Touch.onTouchEvent(widget, buffer, event);
return false;

代码示例来源:origin: lovejjfg/PowerText

Selection.removeSelection(buffer);
super.onTouchEvent(widget, buffer, event);
if (widget instanceof ClickFixedTextView) {

相关文章