當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.setMovementMethod方法代碼示例

本文整理匯總了Java中android.widget.TextView.setMovementMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setMovementMethod方法的具體用法?Java TextView.setMovementMethod怎麽用?Java TextView.setMovementMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setMovementMethod方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: create

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Display dialog with changes.
 */
public static AlertDialog create(Context context) {
    @SuppressLint("InflateParams") final View layoutView =
            ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
                    .inflate(R.layout.dialog_whats_new, null, false);

    TextView view = ((TextView) layoutView.findViewById(R.id.dialog_whats_new_intro));
    view.setText(MiscUtils.fromHtml(context.getString(R.string.whats_new_intro)));
    view.setMovementMethod(LinkMovementMethod.getInstance());

    return new AlertDialog.Builder(context)
            .setTitle(R.string.whats_new_title)
            .setPositiveButton(R.string.ok, null)
            .setView(layoutView)
            .create();
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:19,代碼來源:WhatsNewDialog.java

示例2: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);


    // about_page_textview has links specified by putting <a> tags in the string
    // resource.  By default these links will appear but not
    // respond to user input.  To make them active, you need to
    // call setMovementMethod() on the TextView object.
    TextView aboutPageText = (TextView) findViewById(R.id.about_page_textview);
    aboutPageText.setMovementMethod(LinkMovementMethod.getInstance());

    // This makes the image clickable
    ImageView img = (ImageView)findViewById(R.id.about_page_image);
    img.setOnClickListener(new View.OnClickListener(){
        public void onClick(View v){
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_BROWSABLE);
            intent.setData(Uri.parse("http://serc.strathmore.edu/"));
            startActivity(intent);
        }
    });
}
 
開發者ID:minigridems,項目名稱:SERC-ENERYGY-METERING-MOBILE-APP,代碼行數:26,代碼來源:AboutActivity.java

示例3: initializeLinks

import android.widget.TextView; //導入方法依賴的package包/類
private void initializeLinks() {
  TextView        failureText     = (TextView) findViewById(R.id.sms_failed_text);
  String          pretext         = getString(R.string.registration_progress_activity__signal_timed_out_while_waiting_for_a_verification_sms_message);
  String          link            = getString(R.string.RegistrationProblemsActivity_possible_problems);
  SpannableString spannableString = new SpannableString(pretext + " " + link);

  spannableString.setSpan(new ClickableSpan() {
    @Override
    public void onClick(View widget) {
      new AlertDialog.Builder(RegistrationProgressActivity.this)
              .setTitle(R.string.RegistrationProblemsActivity_possible_problems)
              .setView(R.layout.registration_problems)
              .setNeutralButton(android.R.string.ok, null)
              .show();
    }
  }, pretext.length() + 1, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

  failureText.setText(spannableString);
  failureText.setMovementMethod(LinkMovementMethod.getInstance());
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:21,代碼來源:RegistrationProgressActivity.java

示例4: onCreateDialog

import android.widget.TextView; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
	View dialogView = LayoutInflater.from(getActivity())
			.inflate(R.layout.dialog_message, null);

	TextView messageView = (TextView) dialogView.findViewById(R.id.message);
	messageView.setMovementMethod(LinkMovementMethod.getInstance());
	messageView.setText(Html.fromHtml(getArguments().getString(ARG_MESSAGE)));

	AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_AlertDialog);
	builder.setTitle(getArguments().getString(ARG_TITLE))
			.setIcon(getArguments().getInt(ARG_ICON))
			.setView(dialogView)
			.setPositiveButton(R.string.OK, new OnClickListener() {
				@Override
				public void onClick(DialogInterface dialog, int which) {
					dialog.dismiss();
				}
			});

	return builder.create();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:MessageDialog.java

示例5: onCreateView

import android.widget.TextView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_description, container, false);

    mTitleView = (TextView) rootView.findViewById(R.id.title);
    mSummaryView = (TextView) rootView.findViewById(R.id.summary);

    if (Utils.isTv(getActivity())) {
        mSummaryView.setFocusable(true);
    } else {
        mTitleView.setTextIsSelectable(true);
        mSummaryView.setTextIsSelectable(true);
    }

    mSummaryView.setSelected(true);
    mSummaryView.setMovementMethod(LinkMovementMethod.getInstance());

    mTitle = getArguments().getCharSequence("title");
    mSummary = getArguments().getCharSequence("summary");

    refresh();
    return rootView;
}
 
開發者ID:AyushR1,項目名稱:KernelAdiutor-Mod,代碼行數:26,代碼來源:DescriptionFragment.java

示例6: maybeShowCompatWarningDialog

import android.widget.TextView; //導入方法依賴的package包/類
private void maybeShowCompatWarningDialog() {
    final int stage = mPrefs.getInt("compat_warning_stage", 0);
    if (stage < 2) {
        final TextView msgView = new TextView(getActivity());
        msgView.setText(R.string.compat_warning_message);
        msgView.setMovementMethod(LinkMovementMethod.getInstance());
        final int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16,
                getResources().getDisplayMetrics());
        msgView.setPadding(padding, padding, padding, padding);
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.compat_warning_title);
        builder.setView(msgView);
        builder.setPositiveButton(stage == 0 ? R.string.compat_warning_ok_stage1 :
                R.string.compat_warning_ok_stage2, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                mPrefs.edit().putInt("compat_warning_stage", (stage + 1)).commit();
            }
        });
        builder.setNegativeButton(android.R.string.cancel, null);
        mDialog = builder.create();
        mDialog.show();
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:25,代碼來源:GravityBoxSettings.java

示例7: setData

import android.widget.TextView; //導入方法依賴的package包/類
void setData() {
    TextView title = (TextView) findViewById(R.id.a_title_view);
    TextView type = (TextView) findViewById(R.id.a_type_view);
    TextView subject = (TextView) findViewById(R.id.a_location_view);
    TextView time = (TextView) findViewById(R.id.a_time_view);
    TextView text = (TextView) findViewById(R.id.htexto);
    TextView teacher = (TextView) findViewById(R.id.profesor);

    if (Build.VERSION.SDK_INT >= 21) {
        getWindow().setNavigationBarColor(Color.parseColor(ColorHelper.getColor(data.getType().charAt(0))));
        getWindow().setStatusBarColor(Color.parseColor(ColorHelper.getColor(data.getType().charAt(0))));
    }

    title.setText(data.getTitle());
    type.setText(data.getType());
    subject.setText(data.getSubject());
    text.setText((CharSequence) Html.fromHtml(Uri.parse(data.getText()).toString()));
    text.setMovementMethod(LinkMovementMethod.getInstance());
    teacher.setText(data.getTeacher());

    String ndate = TimeParserHelper.parseTimeDate(getBaseContext(), data.getDate(true));
    if (ndate.length() != 0) {
        time.setText(ndate);
    } else {
        time.setText(data.getDate());
    }

}
 
開發者ID:Onelio,項目名稱:ConnectU,代碼行數:29,代碼來源:AnunciosViewActivity.java

示例8: showDialogAbout

import android.widget.TextView; //導入方法依賴的package包/類
private void showDialogAbout() {
    final SpannableString m = new SpannableString(getString(R.string.dialog_about_text));
    Linkify.addLinks(m, Linkify.WEB_URLS);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.title_about);
    builder.setMessage(m);
    builder.setPositiveButton(R.string.dialog_ok, null);
    AlertDialog alertDialog = builder.show();

    TextView textView = alertDialog.findViewById(android.R.id.message);
    if (textView != null) {
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }
}
 
開發者ID:riteshakya037,項目名稱:Wallpapers-Android-Clean-Architecture,代碼行數:16,代碼來源:OnBoardingActivity.java

示例9: onCreateView

import android.widget.TextView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mGroup = (ViewGroup) getActivity().getWindow().getDecorView();
    view = inflater.inflate(R.layout.tips_window, null);
    textView = (TextView) view.findViewById(R.id.tipsview);
    textView.setMovementMethod(LocalLinkMovementMethod
            .getInstance());
    textView.setText(getTipsString());
    mGroup.addView(view);
    return super.onCreateView(inflater, container, savedInstanceState);
}
 
開發者ID:hh-in-zhuzhou,項目名稱:ShangHanLun,代碼行數:13,代碼來源:TipsWindow.java

示例10: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);

    setContentView(R.layout.activity_main);

    mHandler = new MyHandler(this);

    display = (TextView) findViewById(R.id.outputMonitor);
    display.setMovementMethod(new ScrollingMovementMethod());

    editText = (EditText) findViewById(R.id.outputSendText);
    Button sendButton = (Button) findViewById(R.id.buttonSend);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!editText.getText().toString().equals("")) {
                String data = editText.getText().toString();
                if (usbService != null) { // if UsbService was correctly binded, Send data
                    display.append(data);
                    usbService.write(data.getBytes());
                }
            }
        }
    });
}
 
開發者ID:maks,項目名稱:UartBridge,代碼行數:29,代碼來源:MainActivity.java

示例11: addLinkMovementMethod

import android.widget.TextView; //導入方法依賴的package包/類
private static final void addLinkMovementMethod(TextView t) {
    MovementMethod m = t.getMovementMethod();

    if ((m == null) || !(m instanceof LinkMovementMethod)) {
        if (t.getLinksClickable()) {
            t.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
}
 
開發者ID:coopese,項目名稱:qmui,代碼行數:10,代碼來源:QMUILinkify.java

示例12: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.license_layout);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_license);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(getResources().getString(R.string.License));
    TextView t = (TextView) findViewById(R.id.license);
    t.setMovementMethod(LinkMovementMethod.getInstance());
    TextView t2 = (TextView) findViewById(R.id.license2);
    t2.setMovementMethod(LinkMovementMethod.getInstance());
}
 
開發者ID:MuditSrivastava,項目名稱:Canvas-Vision,代碼行數:15,代碼來源:LicenseActivity.java

示例13: createAndShowDialog

import android.widget.TextView; //導入方法依賴的package包/類
private static void createAndShowDialog(Context context, String title,
                                        SpannableString message, boolean showOkButton) {

    Linkify.addLinks(message, Patterns.WEB_URL, null, new Linkify.MatchFilter() {
        @Override
        public boolean acceptMatch(CharSequence seq, int start, int end) {
            return Linkify.sUrlMatchFilter.acceptMatch(seq, start, end);
        }
    }, null);

    final Dialog dialog = new LovelyInfoDialog(context)
            .setTopColorRes(R.color.colorPrimaryLight)
            .setTitle(title)
            .setIcon(R.drawable.ic_info_outline)
            .setMessage(message)
            .show();

    TextView tvMessage = (TextView) dialog.findViewById(R.id.ld_message);
    if (tvMessage != null) {
        tvMessage.setMovementMethod(LinkMovementMethod.getInstance());
        tvMessage.setLinkTextColor(ContextCompat.getColor(context, R.color.blue));
    }

    if (showOkButton) {
        Button btnOk = (Button) dialog.findViewById(R.id.ld_btn_confirm);
        if (btnOk != null) {
            btnOk.setText(R.string.button_ok);
            btnOk.setTextColor(ContextCompat.getColor(context, R.color.colorPrimaryDark));
        }
    }
}
 
開發者ID:wahibhaq,項目名稱:urdu-font-comparator-app,代碼行數:32,代碼來源:Utils.java

示例14: onCreate

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    // Get preferences
    SharedPreferences preferences =
        PreferenceManager.getDefaultSharedPreferences(this);
    boolean dark = preferences.getBoolean(Main.PREF_DARK, false);

    if (dark)
        setTheme(R.style.AppDarkTheme);

    setContentView(R.layout.help);

    TextView view = (TextView)findViewById(R.id.help);
    String text = RawTextReader.read(this, R.raw.help);
    if (view != null)
    {
        view.setMovementMethod(LinkMovementMethod.getInstance());
        view.setText(Html.fromHtml(text));
    }

    // Enable back navigation on action bar
    ActionBar actionBar = getActionBar();
    if (actionBar != null)
        actionBar.setDisplayHomeAsUpEnabled(true);
}
 
開發者ID:billthefarmer,項目名稱:crossword,代碼行數:29,代碼來源:HelpActivity.java

示例15: configureLinksBehavior

import android.widget.TextView; //導入方法依賴的package包/類
protected void configureLinksBehavior(final TextView text) {
    text.setLinksClickable(false);
    text.setMovementMethod(new LinkMovementMethod() {
        @Override
        public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
            boolean result = false;
            if (!isSelectionModeEnabled) {
                result = super.onTouchEvent(widget, buffer, event);
            }
            itemView.onTouchEvent(event);
            return result;
        }
    });
}
 
開發者ID:sciage,項目名稱:FinalProject,代碼行數:15,代碼來源:MessagesListAdapter.java


注:本文中的android.widget.TextView.setMovementMethod方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。