I’m trying to implement three level list views where only the top level is required to be scrollable. Example of the UI is as below:
List view 1: List of houses : scrollable
List view 2: List of rooms in houses : Not scrollable
List view 3: List of windows in the rooms : Not scrollable
Important thing is that the data I fill up needs to be dynamic. So the number of items in the list view 2 and 3 can be changed.
I don’t want list view 2 and 3 as scrollable as they are not going to have too many items, and I want them to be displayed always. Therefore, only top level list view is required to be scrollable.
I tried with 3 level expandable list views but I really don’t need expandable list views as they increase the number of clicks to view all the information at one time.
I tried is to add ListView within ListView and adding adapter to add items in the low level list views. But its not working. It displays only top level list view but the child list view is not displayed at all.
Is there any way to add ListView within ListView as above?
If there is not much item in listview 2 & 3 then do not use listview for level 2,3.
Use a listview for 1, LinearLayout for 2 & 3 and add textView dynamically to those layouts.
Put 2,3 layout to another linear layout and align it to bottom ... so remaining place above those view will be covered by listview.
Comment if my answer is not clear or you need more explanation.
Related
I have a problem with lists.
I want to implement a scrollable big list, each element of which contains a text on the left side and a NON-scrollable inner list on the right side. (for example: the name of the flat and the list of its inhabitants names)
Both lists should be filled from the cursors and contain an informatio about them: I want to have an oppurtunitz to get all cursos fields when I click an element of the inner list.
As far as I understood I's not possible to solve it with two ListViews. ExpandableListView does not pass me because I do not want to expand the first list, I want to have the inner list always visible.
Do you have any ideas how can I realize it?
Try using a ListView for your big list, and an empty LinearLayout in each item. You fill the LinearLayout of each item programmatically in the big list adapters getView(..) method, where int position is the item number.
See also: android nested listview
Edit: Or use an ExpandableListView, which items you expand programmatically without animation with expandGroup(int position, boolean animate). Prevent collapsing by setting an ExpandableListView.OnGroupCollapseListener, in which you expand the group again. (seems a bit hacky)
Dokumentation: https://developer.android.com/reference/android/widget/ExpandableListView.html
I have been stuck on this for 1 to 2 days. I need help. I want to add a custom child in a listview and a child (row) must contain multiple clickable buttons or views.
I want listview just like one given below:
My GUI:
I am making an app in which the 1st layout contains clickable List having 12 items
and on clicking of each item, the user goes to a new Activity that has Expandable list View.
And I have concerned the tutorial at https://www.youtube.com/watch?v=BkazaAeeW1Q
and do I need to make 12 Activities each containing an Expandable View or is it possible that one Activity containing 12 Expandable Views but only one Expandable view is visible at a time (and which among them is visible will be dependent on Item clicked on the List View of 1st layout)
Hope I am able to make my point clear?
Use List Fragment, by using fragment no need to create 12 activity ,you just replace the container with view.
Also we can make one expandable view at one time, check on child click and onGroupexpand method for that.
I have this row item in my custom list view, and in my array-adapter which I'm using to populate data in this list contains another list in each item. Which I want to show inside the layout out with arrows (shown in image above).
Any tutorial would be helpful
It sounds like you want a create your own View for each item in your listview.
This view would probably be a LinearLayout that you could programatically add new views to. Simply loop through your list within each item, generate the textview / image / whatever that you need, and add it to the linearlayout.
Note: your inner list can't be scrollable independently of the main listview.
I have 2 ListView in a layout. I want each ListView show all their items. And scroll the whole layout.
A answer from one of the ListView Developers from the GoogleIO is: Never put a ListView in a ScrollView. This means if you want a ListView that is not scrolling as you are trying to do you maybe don't need a listview at all.
You could create a ListView put a Linearlayout in it and use the Adapters from the two Listviews to manually add the items of the list via linearlayout.addView Now you have one scrollable view that contains all items of the list. Because there is no recycling and only loading of the items in the list this is very inefficient and only usable if you don't have that much items.
The second more complicated way that you can go if you have say 20 items in each list is to use a custom adapter that takes the two listadapters and let you put all the items in one list.