CharSequence通过意图到达修改

时间:2018-04-25 07:58:49

标签: android

我通过意图附加内容向另一个活动发送CharSequence Spannable,但似乎没有收到相同的序列。

我根据以下答案执行此操作:https://stackoverflow.com/a/45638248/1545435

以下是learnMoreText的内容以及我如何发送内容。它有12个跨度:

enter image description here

@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();
}

enter image description here

有人能指出原因以及如何解决?

0 个答案:

没有答案