1

I need to display a table with an undefined number of rows, and those rows contain links that could scroll the page to other views or start a new activity. Those rows are a bit complex: I need 1 TextView as a "title" and multiple other TextViews to the right of the title which are the links mentioned above.

My table should look like the "stances one from this website: http://ge.jupath.me/GranadoEspadaSEA-Jobs-Fighter.html#Nav

At first I thought of using a custom ArrayAdapter with a ListView, but the problem of using a ListView is that the complete elements are clickable. As I have multiple links in a row this is not a solution. The other problem is that the table is in a scrollView (you can/should not use a ListView as a child of a scrollable view).

Is there a way to use adapters with another view for this? I know I could simply use the addView method, but I'm not sure if it is the right way to do this.

My tables have a maximum of 10 rows.

Lectem
  • 503
  • 6
  • 19
  • Well, I'd still need to iterate through my data and use addView, it seems there's no other way to do it though, according to http://stackoverflow.com/questions/5039465/is-it-possible-to-bind-a-tablelayout-with-a-arrayadapter EDIT : The use of an adapter in this case doesn't seem justified I guess. – Lectem Jul 18 '14 at 20:07
  • If you need some custom View, like cells with many TextViews, then just write your own CustomView that will extend ListView or TableLayout (as you like) and then add new TextViews by using one call to your CustomView. – Boris Mocialov Jul 18 '14 at 20:20
  • Otherwise, as far as I can tell from the link you provided, the challenge is to have multiple links/cell. You can use SpannableString to make multiple links in a single TextView http://stackoverflow.com/questions/15331646/textview-with-multiple-hyperlinks – Boris Mocialov Jul 18 '14 at 20:22
  • Thanks for orienting me to the spannablestring, I found this http://stackoverflow.com/questions/7722806/get-the-value-of-link-text-when-clicked-in-a-textview-in-android and will try it soon. I am now thinking of creating a custom TableLayout, since ListView would only add problems because as it is clickable – Lectem Jul 18 '14 at 20:32
  • http://stackoverflow.com/q/17945498/1276374 – Boris Mocialov Jul 19 '14 at 07:03
  • http://cyrilmottier.com/2011/11/23/listview-tips-tricks-4-add-several-clickable-areas/ In the same way you can add >1 clickable element in ListView item (ex. Spannable text) – Boris Mocialov Jul 19 '14 at 07:05

0 Answers0