本文整理汇总了C#中android.removeSpan方法的典型用法代码示例。如果您正苦于以下问题:C# android.removeSpan方法的具体用法?C# android.removeSpan怎么用?C# android.removeSpan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android
的用法示例。
在下文中一共展示了android.removeSpan方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: markAsReplaced
/// <summary>
/// Marks the specified region of <code>content</code> as having
/// contained <code>original</code> prior to AutoText replacement.
/// </summary>
/// <remarks>
/// Marks the specified region of <code>content</code> as having
/// contained <code>original</code> prior to AutoText replacement.
/// Call this method when you have done or are about to do an
/// AutoText-style replacement on a region of text and want to let
/// the same mechanism (the user pressing DEL immediately after the
/// change) undo the replacement.
/// </remarks>
/// <param name="content">the Editable text where the replacement was made</param>
/// <param name="start">the start of the replaced region</param>
/// <param name="end">the end of the replaced region; the location of the cursor</param>
/// <param name="original">the text to be restored if the user presses DEL</param>
public static void markAsReplaced(android.text.Spannable content, int start, int
end, string original)
{
android.text.method.QwertyKeyListener.Replaced[] repl = content.getSpans<android.text.method.QwertyKeyListener
.Replaced>(0, content.Length);
{
for (int a = 0; a < repl.Length; a++)
{
content.removeSpan(repl[a]);
}
}
int len = original.Length;
char[] orig = new char[len];
Sharpen.StringHelper.GetCharsForString(original, 0, len, orig, 0);
content.setSpan(new android.text.method.QwertyKeyListener.Replaced(orig), start,
end, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE);
}
示例2: onKeyDown
//.........这里部分代码省略.........
selStart = start;
android.text.Selection.setSelection(content, selStart, selEnd);
i = ch;
}
else
{
i = 0;
}
}
if (i != 0)
{
bool dead = false;
if ((i & android.view.KeyCharacterMap.COMBINING_ACCENT) != 0)
{
dead = true;
i = i & android.view.KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (activeStart == selStart && activeEnd == selEnd)
{
bool replace = false;
if (selEnd - selStart - 1 == 0)
{
char accent = content[selStart];
int composed = android.view.KeyEvent.getDeadChar(accent, i);
if (composed != 0)
{
i = composed;
replace = true;
}
}
if (!replace)
{
android.text.Selection.setSelection(content, selEnd);
content.removeSpan(android.text.method.TextKeyListener.ACTIVE);
selStart = selEnd;
}
}
if ((pref & android.text.method.TextKeyListener.AUTO_CAP) != 0 && Sharpen.CharHelper.IsLower
(i) && android.text.method.TextKeyListener.shouldCap(mAutoCap, content, selStart
))
{
int where = content.getSpanEnd(android.text.method.TextKeyListener.CAPPED);
int flags = content.getSpanFlags(android.text.method.TextKeyListener.CAPPED);
if (where == selStart && (((flags >> 16) & unchecked((int)(0xFFFF))) == i))
{
content.removeSpan(android.text.method.TextKeyListener.CAPPED);
}
else
{
flags = i << 16;
i = Sharpen.CharHelper.ToUpper(i);
if (selStart == 0)
{
content.setSpan(android.text.method.TextKeyListener.CAPPED, 0, 0, android.text.SpannedClass.SPAN_MARK_MARK
| flags);
}
else
{
content.setSpan(android.text.method.TextKeyListener.CAPPED, selStart - 1, selStart
, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE | flags);
}
}
}
if (selStart != selEnd)
{
android.text.Selection.setSelection(content, selEnd);
示例3: clearMetaKeyState
public static void clearMetaKeyState(android.text.Editable content, int states)
{
if ((states & META_SHIFT_ON) != 0)
{
content.removeSpan(CAP);
}
if ((states & META_ALT_ON) != 0)
{
content.removeSpan(ALT);
}
if ((states & META_SYM_ON) != 0)
{
content.removeSpan(SYM);
}
if ((states & META_SELECTING) != 0)
{
content.removeSpan(SELECTING);
}
}
示例4: removeSelection
/// <summary>Remove the selection or cursor, if any, from the text.</summary>
/// <remarks>Remove the selection or cursor, if any, from the text.</remarks>
public static void removeSelection(android.text.Spannable text)
{
text.removeSpan(SELECTION_START);
text.removeSpan(SELECTION_END);
}
示例5: stopSelecting
/// <summary>Stop selecting text.</summary>
/// <remarks>
/// Stop selecting text. This does not actually collapse the selection;
/// call
/// <see cref="android.text.Selection.setSelection(android.text.Spannable, int)">android.text.Selection.setSelection(android.text.Spannable, int)
/// </see>
/// too.
/// </remarks>
/// <hide>pending API review</hide>
public static void stopSelecting(android.view.View view, android.text.Spannable content
)
{
content.removeSpan(SELECTING);
}
示例6: release
// no super to call through to
private void release(android.text.Editable content, object what, android.view.KeyEvent
@event)
{
int current = content.getSpanFlags(what);
switch (@event.getKeyCharacterMap().getModifierBehavior())
{
case android.view.KeyCharacterMap.MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED:
{
if (current == USED)
{
content.removeSpan(what);
}
else
{
if (current == PRESSED)
{
content.setSpan(what, 0, 0, RELEASED);
}
}
break;
}
default:
{
content.removeSpan(what);
break;
}
}
}
示例7: resetLock
private static void resetLock(android.text.Spannable content, object what)
{
int current = content.getSpanFlags(what);
if (current == LOCKED)
{
content.removeSpan(what);
}
}
示例8: press
// no super to call through to
private void press(android.text.Editable content, object what)
{
int state = content.getSpanFlags(what);
if (state == PRESSED)
{
}
else
{
// repeat before use
if (state == RELEASED)
{
content.setSpan(what, 0, 0, LOCKED);
}
else
{
if (state == USED)
{
}
else
{
// repeat after use
if (state == LOCKED)
{
content.removeSpan(what);
}
else
{
content.setSpan(what, 0, 0, PRESSED);
}
}
}
}
}
示例9: adjust
private static void adjust(android.text.Spannable content, object what)
{
int current = content.getSpanFlags(what);
if (current == PRESSED)
{
content.setSpan(what, 0, 0, USED);
}
else
{
if (current == RELEASED)
{
content.removeSpan(what);
}
}
}
示例10: resetMetaState
// These bits are privately used by the meta key key listener.
// They are deliberately assigned values outside of the representable range of an 'int'
// so as not to conflict with any meta key states publicly defined by KeyEvent.
/// <summary>Resets all meta state to inactive.</summary>
/// <remarks>Resets all meta state to inactive.</remarks>
public static void resetMetaState(android.text.Spannable text)
{
text.removeSpan(CAP);
text.removeSpan(ALT);
text.removeSpan(SYM);
text.removeSpan(SELECTING);
}
示例11: onTouchEvent
public override bool onTouchEvent(android.widget.TextView widget, android.text.Spannable
buffer, android.view.MotionEvent @event)
{
int initialScrollX = -1;
int initialScrollY = -1;
int action = @event.getAction();
if (action == android.view.MotionEvent.ACTION_UP)
{
initialScrollX = android.text.method.Touch.getInitialScrollX(widget, buffer);
initialScrollY = android.text.method.Touch.getInitialScrollY(widget, buffer);
}
bool handled = android.text.method.Touch.onTouchEvent(widget, buffer, @event);
if (widget.isFocused() && !widget.didTouchFocusSelect())
{
if (action == android.view.MotionEvent.ACTION_DOWN)
{
if (isSelecting(buffer))
{
int offset = widget.getOffsetForPosition(@event.getX(), @event.getY());
buffer.setSpan(LAST_TAP_DOWN, offset, offset, android.text.SpannedClass.SPAN_POINT_POINT
);
// Disallow intercepting of the touch events, so that
// users can scroll and select at the same time.
// without this, users would get booted out of select
// mode once the view detected it needed to scroll.
widget.getParent().requestDisallowInterceptTouchEvent(true);
}
}
else
{
if (action == android.view.MotionEvent.ACTION_MOVE)
{
if (isSelecting(buffer) && handled)
{
// Before selecting, make sure we've moved out of the "slop".
// handled will be true, if we're in select mode AND we're
// OUT of the slop
// Turn long press off while we're selecting. User needs to
// re-tap on the selection to enable long press
widget.cancelLongPress();
// Update selection as we're moving the selection area.
// Get the current touch position
int offset = widget.getOffsetForPosition(@event.getX(), @event.getY());
android.text.Selection.extendSelection(buffer, offset);
return true;
}
}
else
{
if (action == android.view.MotionEvent.ACTION_UP)
{
// If we have scrolled, then the up shouldn't move the cursor,
// but we do need to make sure the cursor is still visible at
// the current scroll offset to avoid the scroll jumping later
// to show it.
if ((initialScrollY >= 0 && initialScrollY != widget.getScrollY()) || (initialScrollX
>= 0 && initialScrollX != widget.getScrollX()))
{
widget.moveCursorToVisibleOffset();
return true;
}
int offset = widget.getOffsetForPosition(@event.getX(), @event.getY());
if (isSelecting(buffer))
{
buffer.removeSpan(LAST_TAP_DOWN);
android.text.Selection.extendSelection(buffer, offset);
}
else
{
if (!widget.shouldIgnoreActionUpEvent())
{
android.text.Selection.setSelection(buffer, offset);
}
}
android.text.method.MetaKeyKeyListener.adjustMetaAfterKeypress(buffer);
android.text.method.MetaKeyKeyListener.resetLockedMeta(buffer);
return true;
}
}
}
}
return handled;
}
示例12: onSpanChanged
public virtual void onSpanChanged(android.text.Spannable s, object what, int start
, int end, int st, int en)
{
if (what == android.text.Selection.SELECTION_END)
{
s.removeSpan(ACTIVE);
}
}
示例13: clear
/// <summary>
/// Clear all the input state (autotext, autocap, multitap, undo)
/// from the specified Editable, going beyond Editable.clear(), which
/// just clears the text but not the input state.
/// </summary>
/// <remarks>
/// Clear all the input state (autotext, autocap, multitap, undo)
/// from the specified Editable, going beyond Editable.clear(), which
/// just clears the text but not the input state.
/// </remarks>
/// <param name="e">the buffer whose text and state are to be cleared.</param>
public static void clear(android.text.Editable e)
{
e.clear();
e.removeSpan(ACTIVE);
e.removeSpan(CAPPED);
e.removeSpan(INHIBIT_REPLACEMENT);
e.removeSpan(LAST_TYPED);
android.text.method.QwertyKeyListener.Replaced[] repl = e.getSpans<android.text.method.QwertyKeyListener
.Replaced>(0, e.Length);
int count = repl.Length;
{
for (int i = 0; i < count; i++)
{
e.removeSpan(repl[i]);
}
}
}