Jay Rathod
Jay Rathod

Reputation: 11245

how to draw a line between dynamically added text-views?

i have a layout which is used to add dynamic text-views. in my layout also their is an edit text what ever text user write in edit text it will shows in dynamically generated text-views. now i have shown that text in text views. But i want to draw line in between every text views generated. Like Below

Text View 1


Text View 2


Text View 3


i am able to do underline of each text views. But i want output like above.

how can i do this?

thanks.

Upvotes: 0

Views: 1048

Answers (1)

Shanmugapriyan
Shanmugapriyan

Reputation: 985

It is very simple you need to create an another two view 1. textview and 2. View For the view you need to set an background drawable as line image.

Textview tv_text = new TextView(this);
View view_line =  new View(this);
tv_text.setText("Text");
View.setBackgroundResource(R.drawable.btn_toggle);
Pref_Layout.addView(tv_text);
Pref_Layout.addView(view_line);

Hope It will work. If you still facing problem. Add it on comment, I will check it again.

Upvotes: 2

Related Questions