本文整理汇总了Java中android.text.method.MovementMethod类的典型用法代码示例。如果您正苦于以下问题:Java MovementMethod类的具体用法?Java MovementMethod怎么用?Java MovementMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MovementMethod类属于android.text.method包,在下文中一共展示了MovementMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClickURL
import android.text.method.MovementMethod; //导入依赖的package包/类
private void onClickURL(){
MovementMethod contributors_descMovementMethod = contributors_desc.getMovementMethod();
if ((contributors_descMovementMethod == null) || !(contributors_descMovementMethod instanceof LinkMovementMethod)) {
if (contributors_desc.getLinksClickable()) {
contributors_desc.setMovementMethod(LinkMovementMethod.getInstance());
}
}
MovementMethod app_report_issues_descMovementMethod = app_report_issues_desc.getMovementMethod();
if ((app_report_issues_descMovementMethod == null) || !(app_report_issues_descMovementMethod instanceof LinkMovementMethod)) {
if (app_report_issues_desc.getLinksClickable()) {
app_report_issues_desc.setMovementMethod(LinkMovementMethod.getInstance());
}
}
MovementMethod app_license_info_descMovementMethod = app_license_info_desc.getMovementMethod();
if ((app_license_info_descMovementMethod == null) || !(app_license_info_descMovementMethod instanceof LinkMovementMethod)) {
if (app_license_info_desc.getLinksClickable()) {
app_license_info_desc.setMovementMethod(LinkMovementMethod.getInstance());
}
}
}
示例2: onCreate
import android.text.method.MovementMethod; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
ButterKnife.bind(this);
setupToolbar();
MovementMethod movementMethod = LinkMovementMethod.getInstance();
versionTextView.setText(getVersionName());
appInfoTextView.setText(StringUtils.fromHtml(getString(R.string.about_app_info)));
appInfoTextView.setMovementMethod(movementMethod);
librariesTextView.setText(StringUtils.fromHtml(getString(R.string.about_libraries_text)));
librariesTextView.setMovementMethod(movementMethod);
licenseTextView.setText(StringUtils.fromHtml(getString(R.string.about_license_text)));
licenseTextView.setMovementMethod(movementMethod);
}
示例3: setMovementMethod
import android.text.method.MovementMethod; //导入依赖的package包/类
/**
* Sets the movement method (arrow key handler) to be used for
* this TextView. This can be null to disallow using the arrow keys
* to move the cursor or scroll the view.
* <p>
* Be warned that if you want a TextView with a key listener or movement
* method not to be focusable, or if you want a TextView without a
* key listener or movement method to be focusable, you must call
* {@link #setFocusable} again after calling this to get the focusability
* back the way you want it.
*/
public final void setMovementMethod(MovementMethod movement) {
if (mMovement != movement) {
mMovement = movement;
if (movement != null && !(mText instanceof Spannable)) {
setText(mText);
}
fixFocusableAndClickableSettings();
// SelectionModifierCursorController depends on textCanBeSelected, which depends on
// mMovement
if (mEditor != null) mEditor.prepareCursorControllers();
}
}
示例4: showResponseText
import android.text.method.MovementMethod; //导入依赖的package包/类
private void showResponseText(final DConnectResponseMessage response) {
View view = findViewById(R.id.response_layout);
view.setVisibility(View.VISIBLE);
final MessageParser parser = new MessageParser();
parser.setClickLinkListener(new MessageParser.OnClickLinkListener() {
@Override
public void onClick(String uri) {
openImageActivity(uri);
}
});
MovementMethod method = LinkMovementMethod.getInstance();
TextView textView = (TextView) findViewById(R.id.response);
textView.setText(parser.parse(response, 4));
textView.setMovementMethod(method);
}
示例5: showEventText
import android.text.method.MovementMethod; //导入依赖的package包/类
private void showEventText(final DConnectEventMessage event) {
View view = findViewById(R.id.event_layout);
view.setVisibility(View.VISIBLE);
final MessageParser parser = new MessageParser();
parser.setClickLinkListener(new MessageParser.OnClickLinkListener() {
@Override
public void onClick(String uri) {
openImageActivity(uri);
}
});
MovementMethod method = LinkMovementMethod.getInstance();
TextView textView = (TextView) findViewById(R.id.event);
textView.setText(parser.parse(event, 4));
textView.setMovementMethod(method);
}
示例6: onTouchEvent
import android.text.method.MovementMethod; //导入依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
MovementMethod movementMethod = getMovementMethod();
if (movementMethod instanceof TouchableMovementMethod) {
TouchableBaseSpan span = ((TouchableMovementMethod) movementMethod).getPressedSpan();
if (span != null) {
return true;
}
}
return false;
}
示例7: onCreate
import android.text.method.MovementMethod; //导入依赖的package包/类
protected void onCreate(Bundle savedInstance) {
super.onCreate(savedInstance);
setContentView(R.layout.activity_main);
mContext = this;
prefs = PreferenceManager.getDefaultSharedPreferences(this);
String text = "This is a #test of regular expressions with http://example.com/ links as used in @twitter for performing various operations based on the links this handles multiple links like http://this_is_fun.com/ and #Awesomess and @Cool";
// textview = new LinkEnabledTextView(this, null);
textview = (LinkEnabledTextView) findViewById(R.id.textview);
textview.setOnTextLinkClickListener(this);
textview.gatherLinksForText(text);
edittext = (LinkEnabledEditText) findViewById(R.id.edittext);
edittext.setText(prefs.getString("edittextstring", ""));
edittext.gatherLinksForText();
edittext.setOnTextLinkClickListener(this);
MovementMethod m = textview.getMovementMethod();
if ((m == null) || !(m instanceof LinkMovementMethod)) {
if (textview.getLinksClickable()) {
textview.setMovementMethod(LinkMovementMethod.getInstance());
}
}
}
示例8: onCreate
import android.text.method.MovementMethod; //导入依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
// apply the link movement method to all appropriate text views to allow the user to click
// any anchors
final MovementMethod movementMethod = LinkMovementMethod.getInstance();
appCredits.setMovementMethod(movementMethod);
contentCredits.setMovementMethod(movementMethod);
styleCredits.setMovementMethod(movementMethod);
backendCredits.setMovementMethod(movementMethod);
interfaceCredits.setMovementMethod(movementMethod);
// setup the action bar, setting the logo and title and enabling the home button
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setIcon(R.drawable.spaced_logo);
actionBar.setTitle(R.string.about_activity_title);
}
示例9: onActivityCreated
import android.text.method.MovementMethod; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
int padding = (int) (getResources().getDisplayMetrics().density * 8); // 8dip
ListView listView = getListView();
listView.setPadding(padding, 0, padding, 0);
listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
listView.setDivider(null);
LayoutInflater inflater = LayoutInflater.from(getActivity());
View header = inflater.inflate(R.layout.list_header_footer, listView, false);
View footer = inflater.inflate(R.layout.list_footer, listView, false);
TextView tv = (TextView) footer.findViewById(R.id.footer);
String str = getResources().getString(R.string.footer);
MovementMethod method = LinkMovementMethod.getInstance();
tv.setMovementMethod(method);
CharSequence html = Html.fromHtml(str);
tv.setText(html);
listView.addHeaderView(header, null, false);
listView.addFooterView(footer, null, false);
setTrack(7);
}
示例10: onCreateView
import android.text.method.MovementMethod; //导入依赖的package包/类
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState )
{
View view = inflater.inflate( R.layout.fragment_about, container, false );
ButterKnife.inject( this, view );
Dialog dialog = getDialog();
if( dialog != null )
{
dialog.setTitle( R.string.about_title );
}
Button marketButton = (Button) view.findViewById( R.id.ABOUT_market_button );
marketButton.setOnClickListener( this );
MovementMethod linkMovementMethod = LinkMovementMethod.getInstance();
m_githubAndroidView.setMovementMethod( linkMovementMethod );
m_githubAndroidView.setText( getText( R.string.about_body_github_android ) );
m_githubFeedbackView.setMovementMethod( linkMovementMethod );
m_githubFeedbackView.setText( getText( R.string.about_body_feedback ) );
m_versionView.setText( "v" + getAppVersion() );
return view;
}
示例11: s
import android.text.method.MovementMethod; //导入依赖的package包/类
public s(View paramView, boolean paramBoolean)
{
this.a = ((TextView)paramView.findViewById(2131230732));
this.b = ((TextView)paramView.findViewById(2131230733));
if (ao.m());
for (Object localObject = u.a(); ; localObject = LinkMovementMethod.getInstance())
{
this.b.setMovementMethod((MovementMethod)localObject);
if (paramBoolean)
{
this.b.setSingleLine(true);
this.b.setEllipsize(TextUtils.TruncateAt.END);
this.a.setTextColor(paramView.getContext().getResources().getColor(2131165198));
}
return;
}
}
示例12: addLinkMovementMethod
import android.text.method.MovementMethod; //导入依赖的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());
}
}
}
示例13: onTouchEvent
import android.text.method.MovementMethod; //导入依赖的package包/类
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
MovementMethod mm = getMovementMethod();
CharSequence text = getText();
if (mm != null && (text instanceof Spannable)
&& handleTouchEvent(event)) {
mm.onTouchEvent(this, (Spannable) text, event);
if (dispatchToParent) {
return false;
}
}
return super.onTouchEvent(event);
}
示例14: performLongClick
import android.text.method.MovementMethod; //导入依赖的package包/类
@Override
public boolean performLongClick() {
MovementMethod mm = getMovementMethod();
if (mm != null && (mm instanceof MyLinkMovementMethod))
((MyLinkMovementMethod) mm).a(this);
return super.performLongClick();
}
示例15: addLinkMovementMethod
import android.text.method.MovementMethod; //导入依赖的package包/类
private static void addLinkMovementMethod(TextView t) {
MovementMethod m = t.getMovementMethod();
if ((m == null) || !(m instanceof LinkMovementMethod)) {
if (t.getLinksClickable()) {
t.setMovementMethod(LinkMovementMethod.getInstance());
}
}
}