我通过意图附加内容向另一个活动发送CharSequence
Spannable
,但似乎没有收到相同的序列。
我根据以下答案执行此操作:https://stackoverflow.com/a/45638248/1545435
以下是learnMoreText
的内容以及我如何发送内容。它有12
个跨度:
@Override
public void onItemLearnMoreClick(View view, int position) {
Intent intent = new Intent(getContext(), LearnMoreActivity.class);
CharSequence learnMoreText = model.getLearnMoreText(position);
intent.putExtra(LearnMoreActivity.EXTRA_LEARN_MORE, learnMoreText);
String learnMoreType = model.getLearnMoreType(position);
intent.putExtra(LearnMoreActivity.EXTRA_LEARN_MORE_TYPE, learnMoreType);
startActivity(intent);
}
以下是我在LearnMoreActivity中收到的方式。现在它只包含10
个跨度。链接跨度<a></a>
是条纹的:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivityComponent().inject(this);
LearnMoreActivityBinding binding = DataBindingUtil.setContentView(this, R.layout.learn_more_activity);
CharSequence learnMoreHtmlText = getIntent().getCharSequenceExtra(EXTRA_LEARN_MORE);
binding.contentText.setText(learnMoreHtmlText);
binding.contentText.setLinksClickable(true);
binding.contentText.setMovementMethod(LinkMovementMethod.getInstance());
setupToolbar();
}
有人能指出原因以及如何解决?