android.widget.TextView#getMovementMethod ( )源码实例Demo

下面列出了android.widget.TextView#getMovementMethod ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: socialview   文件: SocialViewHelper.java
/**
 * Configuring {@link SocialView} into given view.
 *
 * @param view  TextView to install SocialView into.
 * @param attrs The attributes from the View's constructor.
 */
public SocialViewHelper(@NonNull TextView view, @Nullable AttributeSet attrs) {
    this.view = view;
    this.initialMovementMethod = view.getMovementMethod();

    view.addTextChangedListener(textWatcher);
    view.setText(view.getText(), TextView.BufferType.SPANNABLE);
    final TypedArray a = view.getContext().obtainStyledAttributes(
        attrs, R.styleable.SocialView, R.attr.socialViewStyle, R.style.Widget_SocialView
    );
    flags = a.getInteger(R.styleable.SocialView_socialFlags, FLAG_HASHTAG | FLAG_MENTION | FLAG_HYPERLINK);
    hashtagColors = a.getColorStateList(R.styleable.SocialView_hashtagColor);
    mentionColors = a.getColorStateList(R.styleable.SocialView_mentionColor);
    hyperlinkColors = a.getColorStateList(R.styleable.SocialView_hyperlinkColor);
    a.recycle();
    recolorize();
}
 
源代码2 项目: android_9.0.0_r45   文件: Linkify.java
private static final void addLinkMovementMethod(@NonNull TextView t) {
    MovementMethod m = t.getMovementMethod();

    if ((m == null) || !(m instanceof LinkMovementMethod)) {
        if (t.getLinksClickable()) {
            t.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
}
 
源代码3 项目: Markwon   文件: CorePlugin.java
@Override
public void afterSetText(@NonNull TextView textView) {
    // let's ensure that there is a movement method applied
    // we do it `afterSetText` so any user-defined movement method won't be
    // replaced (it should be done in `beforeSetText` or manually on a TextView)
    if (textView.getMovementMethod() == null) {
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }
}
 
源代码4 项目: fanfouapp-opensource   文件: LinkifyCompat.java
private static final void addLinkMovementMethod(final TextView t) {
    final MovementMethod m = t.getMovementMethod();

    if ((m == null) || !(m instanceof LinkMovementMethod)) {
        if (t.getLinksClickable()) {
            t.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
}
 
 方法所在类
 同类方法