Linearlayout like a "ListView" containing objects in android? - android-layout

I am making a list using LinearLayout and would like to add several "person"-objects to my "list"
I need to be able to click on an object in this list an pull out the person object or at least the personId to be able to find the specific person in my database.
How do I go about doing this?
I have tried using a TextView but it is too simple to contain all of the desired values.
I have also tried using a ListView but I have several LinearLayout next to each other. The ListView scroll individually and therefore I can't use them
Here is an image:
As you can see I am trying to make a grid of sorts each column is a linearview and at the moment so are each row.
I realize there is a grid but I need to be able to fit objects in where I want them and I am too inexperienced to write my own adapter for the gridview

You can achieve this using a ListView with a custom ArrayAdapter.
Check out this example.
Instead of the Weather class, use your own Person object and make the necessary modifications.
Edit:
After reading your edit, I can see that you have some kind of Grid. So my best guess would be to use a GridView with a custom adapter.
Since you are getting your data from a database, you might as well use a custom CursorAdapter.
But I still haven't figured out what you're trying to do.
It seems that you want all the cells to be visible. That would only mean you have a small/finite amount of cells, and in that case a GridView wouldn't be any better than a for loop that adds views to a layout.

Related

Creating a custom layout for horizontal buttons with wrapping

I wasn't sure what to title this without explaining it all there. Essentially, I want to populate part of a screen with a bunch of buttons. The buttons should have text from an ArrayList (or other structure) and they should be aligned horizontally to each other from the left to the right of the screen. When there is no more room to the right, it starts a new row. I've attached an example. Example layout here
I know how to make custom list adapters for my objects and how to make listeners for parts within the list items, but I'm just not sure how to make the "list" of buttons go horizontally with wrapping to the next line.
It seems https://github.com/google/flexbox-layout might help you.
You can use FlexboxLayoutManager as adapter, or simply place all the buttons inside FlexboxLayout, they will wrap automatically depending on their width.

Disable sorting on one or more grid columns in Kendo UI for Angular

I'm playing around a bit with Kendo UI for Angular and can't seem to find an easy way to disable sorting on specific columns of a grid.
There's an allowUnsort in sort-settings.d.ts, but I'm uncertain on how to use this (and this appears to relate to removing sorting afterwards, not from the start).
Or perhaps I'm simply using the grid wrong, that's also possible..
My situation is as follows:
I'm trying to use a grid to display some rows, and depending on the type of data, it should render a different icon in the first column. Also, I'm not using a 'real' header in that column, but replaced it with a button to create a new row.
To get my button in the header, I use a <template kendoGridHeaderTemplate ...>...</template>. This always seems to add a link around the header cell if sortable is enabled, which is what I'm trying to avoid (in some cases).
Is there a way around this?
Setting [sortable]="true" for the Grid component will enable sorting globally. Then you can fine-tune which column has sorting by disabling it per column, i.e [sortable]="false"
Here is a quick example:
http://plnkr.co/edit/hLbzC5jKJwVdMtRmh0cH?p=preview

Getting Value Picker and HughesConnect Viewpicker combination in XPages

I have an application that uses the Ext Lib value picker from a view and it works but it is very cludgy. The reason is that there are over a thousand choices and the user has to scroll through them all to get to where he/she wants to go. I want to use the HughesConnect.com picklist CC, which is very nice. However, I am having trouble with a particular issue that is probably very simple but I can't figure it out.
I want to be able to use the HughesConnect.com picklist CC to grab one value at a time and put it into a field. Then, when the user clicks on the button again, I just want them to have the ability to grab a value and append it to the same field. Every time I run it now, it is just overwriting the field. I can't use Multi Value in the CC because the view has multi values in the column from the same document. I have found that if this is the case, it doesn't work. No matter what I try. I am not very good with arrays in XPages, so I am likely doing something wrong and to be honest, I don't even have any sample code because everything I have tried hasn't worked.
I am starting to wonder whether it's even possible but it sounds so simple that it must be.
The Value Picker allows you to add a search with a view data source. Is there a reason for not using that? I can't remember if search support multi-select. It may not.
If you want to use Mark's view picker, how about getting a bit creative. Push the value into a Hidden Input field that has an onChange event. In the onChange event, append the value to a different multi-value field. If you bind the Dojo List Text Box to your multi-value field, it will make it easier for users to deselect entries. It's a bit creative, but should produce exactly the result you're looking for.

No section wrapping in UICollectionView

I am using UICollectionView to display cells but I would like to change the default wrapping behaviour in the sections. I don't want any wrapping, instead, I would like the equivalent of a variable width horizontal scrollview for each section, like shown in the following image.
I can do this using horizontal scrollviews within a vertical scrollview but I would like to use a collection view. Any idea on how to do this with a custom flow layout maybe?
Thanks!
You can nest collection views, but you have to be careful separating their delegates to avoid having one collection view being affected by a call to the other.
Create the first collection view with vertical scrolling and as many sections you like. Its delegate must be the controller view it is embedded in. Subclass its cell.
Inside the first collection view's cell create a second collection view with horizontal scrolling. Its delegate is the cell of the first collection view.
You can find an example here: Issue with nested UICollectionViews

DrawItem in listbox (VC++)

When we will use DrawItem for a listbox?
Normally, if the listbox is ownerdraw, we will use DrawItem. What are the other senarios we use drawitem?
To elaborate on Rashmi Pandit; A ListBox with override DrawItem can also be used to 'visualize' objects. In a project I'm working on, a ListBox is used to display rows from a database. Each row / item is visualized using formatted Strings, Icons etc.
Overriding DrawItem (and MeasureItem!) is ideal for this purpose. Of course, the internal structure has to be tweaked a bit (the standard Items property cannot be used for objects), but it is certainly worthwhile.
Message WM_DRAWITEM is sent only to owner-drawn List boxes.
You can use DrawItem when you want to override the default implementation and custom the way a listbox is drawn. For e.g. in the list there might be some item which should is the default item and you would want it to be highlighted so that the user knows it is the default item.
Here's an eg for a combo in C#: Higlighting a particular item in a combo box

Resources