How to load a listview into another listview?

1

Good morning.

I have a listView in which I must load another data list into it, that is, in each item of the listView there is a button, when that button is pressed I should bring a list of data, but I have not found the way to solve this situation.

Thank you in advance.

    
asked by devjav 25.11.2016 в 20:51
source

1 answer

2

A ListView has a list of elements which can be displayed by scroll, if you add another element that has its own scroll it would be a bit complicated to use it and it would not be recommended.

  

I have a listView in which I must load into it another   list of data, that is, in each item of the listView there is a button,   when you press that button you should bring me a list of data

I think it is advisable here that this button generates a list but within a LinearLayout and not another listView , for example the button within the ListView can generate a linear layout with its elements in the form of a list:

LinearLayout root = (LinearLayout) findViewById(R.id.my_root);
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.HORIZONTAL);
linearLayout.addView(myTextView1);
linearLayout.addView(myTextView2);
linearLayout.addView(myTextView3);
linearLayout.addView(myTextView4);
linearLayout.addView(myTextView5);
...
...
root.addView(linearLayout);
    
answered by 25.11.2016 в 21:08