ReclycleView with grouped data and responsive header for Landscape and Portrait mode - android

I am trying to achieve something like the picture, I have grouped data , and every group can have 1 or more (different count of items) , most items in the groups share the view type which is simple icon , title, description kind.
But the tricky part is how can I get the header (in landscape mode ) aligned to first item of the group , and allow it to scroll with the list.
One way I could think was let one item in the recycleView be the whole group . i.e header + list items , but that would not give the recycling of the views, defeating whole purpose of reclycleview.
I am looking for some pointers or ideas on how I could approach this.
Note : Header height could be larger that item height and may extend till second item in the group. basically imagine the header to be an Icon and text

Related

Recyclerview with X items and View more button

I would like to know if there is any way how to implement RecyclerView with only part of the collection. For example, the ArrayList would have 10 bitmaps in it, but only 6 can fit the screen without scrolling. So I want to show only 5 of them, and the 6th would be a clickable Button/ImageView which would say 'View 5 more'.
Is it possible to achieve this? Thanks.
one way would be having 2 lists in your adapter, one is the list that you actually show (show list) and the other one the full dataset. as long as you're not showing the full dataset, add a row at the end with the button show more, when clicking the button add a new batch of items from the full dataset to the show list.

How to get the view in a custom list view at a specific position? Android?

Let me explain this--
For example - I have a custom list view set up that shows 3 text fields in a group.. I.e. each click able item in that list view will have 3 texts.. so now I want to get the 2nd text view at the 5th index of that listview...How to achieve this?
If a have a basic listview with only one item at each index, then this can be achieved by using getItemAtPosition().
Is this similar in the above case also?
You don't. THe entire point of a listview is that it DOESNT create views for every element in the list- only the ones on screen. So if your list is more than trivially long, it probably doesn't have a view for that item. If you think you need this, you're probably architecting your code wrong for a listview.

Inner List in Android

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

How to create a title row in a listview in android?

I have a listview in android with several columns, and for each column I want to set a separate title, as shown in this example below (I mean the fields 'Name and Number', 'SMS, 'Phone'):
(The image is just to explain what I want; in my layout there are more columns which are not as self-explaining as in the example).
Is there a good way to do that? Als, is it possible that this title row can be visible at all time, even when I have many many rows and scroll down?
If you want to have a fixed header item in the list that doesn't scroll with the other items, use ListView's addHeaderView to indicate which view(s) should stick to the top.
If you just want the first item to be different than the others, you'll have to code your ListAdapter to have two types of views, one for the header, and another for the rest. This involves
Making getViewTypeCount return 2 to say it can make two different kinds of views.
Making getItemViewType return 0 or 1 to say which type of view will be generated for the given position in the list.
Making getView return the correct view object for the given position in the list.
Presumably you'd want position 0 to be the header view and all other positions to be data.

Extended list view: Show text input inside once clicked

I am working on a UI where I have a list view. Each row has 2 information. One is Product name and the other is product ID stacked one over other. So each row has 2 lines of data.
What i want to do with this:
Once a user clicks on each row, it will further expand and show one input and one spinner. So it is basically for putting in Quantity and unit of measure.
Please let me know if this is achievable and if I can refer to some example.
What I need is more like
Taskos To Do List | Task List
https://play.google.com/store/apps/details?id=com.taskos&hl=en
All i need is that the category will not be expandable. Only the items will be expandable. All i need is an example of such app and then I can take it forward.
I think it could be done... you would need to put the extra widgets in your row layout, populate them and hide them upon list creation, then in your onListItemCLick you could unhide them.
Note I have no idea if this would work, but it seems reasonable that it might and it's what I would try and do to achieve the goal.
listView cannot be expanded. however you can use an expandablelistView
But the kind of functionality you want cannot be done this way(I guess.).
You can use
registerForContextMenu("your list View");
to register your list view
onCreateContextMenu
for the kind of action you want to be performed in your case its dialog with EditText and Spinner to have input from user

Categories

Resources