当前位置: 首页>>代码示例>>Java>>正文


Java TextView.setAutoLinkMask方法代码示例

本文整理汇总了Java中android.widget.TextView.setAutoLinkMask方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setAutoLinkMask方法的具体用法?Java TextView.setAutoLinkMask怎么用?Java TextView.setAutoLinkMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setAutoLinkMask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: displayAboutDialog

import android.widget.TextView; //导入方法依赖的package包/类
private void displayAboutDialog() {
    final int paddingSizeDp = 5;
    final float scale = getResources().getDisplayMetrics().density;
    final int dpAsPixels = (int) (paddingSizeDp * scale + 0.5f);

    final TextView textView = new TextView(this);
    final SpannableString text = new SpannableString(getString(R.string.about_dialog_text));

    textView.setText(text);
    textView.setAutoLinkMask(RESULT_OK);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setPadding(dpAsPixels, dpAsPixels, dpAsPixels, dpAsPixels);

    Linkify.addLinks(text, Linkify.ALL);
    new AlertDialog.Builder(this)
            .setTitle(R.string.menu_about)
            .setCancelable(false)
            .setPositiveButton(android.R.string.ok, null)
            .setView(textView)
            .show();
}
 
开发者ID:xiaoyaoyou1212,项目名称:XSnow,代码行数:22,代码来源:MainActivity.java

示例2: initialize

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void initialize(final Activity activity, Tab tab) {
    Resources resources = activity.getResources();
    mSuccessColor = colorToHexValue(ApiCompatibilityUtils.getColor(resources,
            R.color.physical_web_diags_success_color));
    mFailureColor = colorToHexValue(ApiCompatibilityUtils.getColor(resources,
            R.color.physical_web_diags_failure_color));
    mIndeterminateColor = colorToHexValue(ApiCompatibilityUtils.getColor(resources,
            R.color.physical_web_diags_indeterminate_color));

    LayoutInflater inflater = LayoutInflater.from(activity);
    mPageView = inflater.inflate(R.layout.physical_web_diagnostics, null);

    mLaunchButton = (Button) mPageView.findViewById(R.id.physical_web_launch);
    mLaunchButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            activity.startActivity(createListUrlsIntent());
        }
    });

    mDiagnosticsText = (TextView) mPageView.findViewById(R.id.physical_web_diagnostics_text);
    mDiagnosticsText.setAutoLinkMask(Linkify.WEB_URLS);
    mDiagnosticsText.setText(Html.fromHtml(createDiagnosticsReportHtml()));
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:PhysicalWebDiagnosticsPage.java

示例3: showDialog

import android.widget.TextView; //导入方法依赖的package包/类
private void showDialog() {
    Builder builder = new Builder(this.mContext);
    TextView title = new TextView(this.mContext);
    title.setText("分享失败原因");
    title.setPadding(0, 20, 0, 20);
    title.setTextColor(-1);
    title.setGravity(17);
    title.setTextSize(16.0f);
    builder.setCustomTitle(title);
    TextView textView = new TextView(this.mContext);
    textView.setText("请添加QQ平台到SDK \n添加方式:\nUMQQSsoHandler qqSsoHandler = new UMQQSsoHandler" +
            "(getActivity(), \"你的APP ID\",\"你的APP KEY\");\nqqSsoHandler.addToSocialSDK(); " +
            "\n参考文档:\nhttp://dev.umeng" +
            ".com/social/android/share/quick-integration#social_qq_sso");
    textView.setTextColor(-1);
    textView.setTextSize(16.0f);
    textView.setAutoLinkMask(1);
    builder.setView(textView);
    builder.show().show();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:UMQQSsoHandler.java

示例4: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scan_result);

    String content = getIntent().getStringExtra(KEY_CONTENT);

    TextView tv_content = (TextView) findViewById(R.id.tv_content);
    tv_content.setText(content);
    //超链接相关字符识别
    tv_content.setAutoLinkMask(Linkify.ALL);
    tv_content.setMovementMethod(LinkMovementMethod.getInstance());

}
 
开发者ID:Jusenr,项目名称:zxing_qrcode_demo,代码行数:15,代码来源:ScanResultActivity.java

示例5: onTouchEvent

import android.widget.TextView; //导入方法依赖的package包/类
public boolean onTouchEvent(TextView view, Spannable text, MotionEvent event) {
    if (this.activeTextViewHashcode != view.hashCode()) {
        this.activeTextViewHashcode = view.hashCode();
        view.setAutoLinkMask(0);
    }

    BetterLinkMovementExtended.ClickableSpanWithText touchedClickableSpan = this.findClickableSpanUnderTouch(view, text, event);
    if (touchedClickableSpan != null) {
        this.highlightUrl(view, touchedClickableSpan, text);
    } else {
        this.removeUrlHighlightColor(view);
    }

    clickGestureListener.listener = new GestureDetector.SimpleOnGestureListener() {
        @Override public boolean onDown(MotionEvent e) {
            touchStartedOverLink = touchedClickableSpan != null;
            return true;
        }

        @Override public boolean onSingleTapUp(MotionEvent e) {
            if (touchedClickableSpan != null && touchStartedOverLink) {
                dispatchUrlClick(view, touchedClickableSpan);
                removeUrlHighlightColor(view);
            }

            touchStartedOverLink = false;
            return true;
        }

        @Override public void onLongPress(MotionEvent e) {
            if (touchedClickableSpan != null && touchStartedOverLink) {
                dispatchUrlLongClick(view, touchedClickableSpan);
                removeUrlHighlightColor(view);
            }

            touchStartedOverLink = false;
        }
    };

    boolean ret = gestureDetector.onTouchEvent(event);

    if(!ret && event.getAction() == MotionEvent.ACTION_UP) {
        clickGestureListener.listener = null;
        removeUrlHighlightColor(view);
        this.touchStartedOverLink = false;
        ret = true;
    }

    return ret;
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:51,代码来源:BetterLinkMovementExtended.java


注:本文中的android.widget.TextView.setAutoLinkMask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。