0

I have the following situation: there is the textview on my screen. This textview has onClickListener. Than I need to set Spannable text to this textView. The part of the spannable text has it's own click listener. For this purpose, I clear textview listener, but in this situation, TextView is not clickable at all:

public void setExpandableClickListenerForPaymentsMethod(SpannableStringBuilder spannableStringBuilder) {
    loanDetailTv.setOnClickListener(null);

    ClickableSpan linkSpan = new ClickableSpan() {
        @Override
        public void onClick(@NonNull View widget) {
            getController().onRestructingClick();
        }
    };
    spannableStringBuilder.setSpan(linkSpan, 45, 129, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    loanDetailTv.setText(spannableStringBuilder);
}

What's the reason and how can I solve it?

Sergei Mikhailovskii
  • 2,100
  • 2
  • 21
  • 43

1 Answers1

1

try to make the textview not clickable like this:

textview.clickable = false; 
julianpjp
  • 112
  • 1
  • 8
  • ok, see here this is a similiar question maybe this will work for you https://stackoverflow.com/questions/5183645/android-clickablespan-in-clickable-textview – julianpjp Jul 14 '20 at 19:18