1

我正在通过意图附加功能将 a 发送CharSequenceSpannable另一个 Activity,但似乎没有收到相同的序列。

我是根据以下答案来做的: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();
}

在此处输入图像描述

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

4

0 回答 0