如何在TextView中的部分文字上响应点击事件
1个回答
展开全部
您好,很高兴为您解答。
package com.TextHtml; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.text.Html; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.text.style.URLSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class TextHtml extends Activity { /* * Called when the activity is first created. */ private TextView tv; static Context ctx = null ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
package com.TextHtml; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.text.Html; import android.text.Spannable; import android.text.SpannableStringBuilder; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.text.style.URLSpan; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class TextHtml extends Activity { /* * Called when the activity is first created. */ private TextView tv; static Context ctx = null ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询