-1

Hi i want to create a list of textview with each item clickable like in the image.

enter image description here

Shanmugapriyan M
  • 301
  • 5
  • 17

1 Answers1

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