package com.jesseblack;
import com.jesseblack.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Parcel;
import android.text.ParcelableSpan;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;
public class TestLinkActivity extends Activity {
private TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView view6 = (TextView) findViewById( R.id.tv123);
SpannableString text6 = new SpannableString("@jesseblack:letters is ...");
Intent intent = new Intent(this, TestActivity2.class);
text6.setSpan(new IntentSpan(intent), 0, 11, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
view6.setText( text6 );
view6.setMovementMethod(LinkMovementMethod.getInstance());
}
public class IntentSpan extends ClickableSpan implements ParcelableSpan {
private Intent mIntent;
public IntentSpan(Intent toActivity) {
mIntent = toActivity;
}
@Override
public void updateDrawState(TextPaint ds) {
ds.setColor(Color.parseColor("#00BFFF"));
ds.setUnderlineText(false);
}
@Override
public void onClick(View sourceView) {
Context context = sourceView.getContext();
context.startActivity( mIntent );
}
public int getSpanTypeId() {
return 100;
}
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flag) {
// don't write to parcel
}
public Intent getIntent() {
return mIntent;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
JesseBlackTestLink.rar (40个子文件)
JesseBlackTestLink
.project 855B
project.properties 360B
proguard.cfg 1KB
src
com
jesseblack
TestActivity2.java 320B
TestLinkActivity.java 2KB
AndroidManifest.xml 928B
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher.png 4KB
drawable-mdpi
ic_launcher.png 3KB
layout
test.xml 412B
main.xml 495B
drawable-xhdpi
values
strings.xml 372B
.settings
org.eclipse.jdt.core.prefs 177B
org.eclipse.core.resources.prefs 57B
assets
gen
com
jesseblack
BuildConfig.java 156B
R.java 842B
.classpath 475B
bin
TestLink.apk 16KB
resources.ap_ 11KB
classes
com
jesseblack
R$layout.class 410B
BuildConfig.class 337B
R$drawable.class 395B
R$attr.class 328B
TestLinkActivity$IntentSpan.class 2KB
R$id.class 371B
TestLinkActivity.class 1KB
TestActivity2.class 512B
R.class 503B
R$string.class 448B
AndroidManifest.xml 928B
dexedLibs
annotations-cb50acbe06b613c07f58990c693ea3f0.jar 943B
jarlist.cache 120B
res
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher.png 4KB
drawable-mdpi
ic_launcher.png 2KB
crunch
drawable-ldpi
ic_launcher.png 2KB
drawable-hdpi
ic_launcher.png 4KB
drawable-mdpi
ic_launcher.png 2KB
classes.dex 6KB
TestLinkNoUnderline.apk 16KB
共 40 条
- 1
资源评论
- shimeitang2014-08-3010行不到的有效代码, 没什么干货, 度娘上一搜一大把,还比这详细.
- skyyhu2015-06-03还不错,已经用到项目中了
GeekLei
- 粉丝: 28
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功