0

I have multiple textviews. And all textviews are one word. I want to build a paragraph by using them. But they should not lose their textview feature. So they should not be used as string. Because then, I want them to be clickable one by one.

Baris
  • 31
  • 5

2 Answers2

0

You can use a single textview and spannable string to make the words clickable separately.

NIKHIL AGGARWAL
  • 448
  • 4
  • 9
  • Thanks for your help. But I cant differentiate spannable string ID's. Just like my example: https://stackoverflow.com/questions/60930415/could-we-define-unknown-amount-of-clickable-texts-which-have-different-outputs-i – Baris Mar 30 '20 at 18:07
0
      TextView textview1,textview2,textview3;

   @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.activity_main);


    textview1 = findViewById(R.id.textview1);

    textview2 = findViewById(R.id.textview2);

    textview3 = findViewById(R.id.textview3);

    textview1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

           //

        }
    });




   textview2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

           //

        }
    });


     textview3.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

           //

        }
    });



 }
Shimaa Yasser
  • 587
  • 4
  • 12