Hi i want to create a list of textview with each item clickable like in the image.
Asked
Active
Viewed 39 times
-1

Shanmugapriyan M
- 301
- 5
- 17
-
1try this https://stackoverflow.com/a/10697453/3319074 – ZeroOne Jul 11 '17 at 15:40
-
@ZeroOne is right you can use SpannableString. Using that you can add multiple clickable span in your TextView as per you need – Himanshu Dudhat Jul 11 '17 at 16:05
1 Answers
0
In your onClick or in the Event you want to add a TextView try this:
TextView textView = new TextView(Activity.this);
textView.setText();
textView.setTextColor();
textView.setTextSize();
textView.setOnClickListener();
Now suppose you have a horizontal LinearLayout then
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//Set your margins here.
params.topMargin = 0;
params.rightMargin = 0;
params.leftMargin = 0;
params.bottomMargin = 0;
textView.setLayoutParams(params);
linearLayout.addView(textView);
Hope this helps.

Sarthak Gandhi
- 2,130
- 1
- 16
- 23