當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。