JavaFX equivalent to ListView in Android - android

Is there a JavaFX equivalent to the Android SDK's listview where you can customize the items to have a specific layout using xml?
For instance in Android, if every item needs to have two text boxes for two separate properties, you can make a custom ArrayAdapter and populate the listview using that.
As far as I know, the ListView in FX isn't built for that.
Thanks in advance

Related

How to put together the custom adapter, date models and Layouts for the TableView library by evrencoskun to work?

I just recently started programming on android and my basic ListViews no longer work for the data I need to show so I'm trying to use the TableView library by evrencoskun (https://github.com/evrencoskun/TableView#documentation).
The problem is I'm not quite following the documentation of how to implement it.
The documentation shows how to create a "custom adapter", "date models" and "Layouts" but I don't know if creating all of those is mandatory for my TableView to work (also I don't get where should I put the "date models") and I have no idea of how to link them up for my ListView to work.
I was also considering using ISchwarz23 ListView library which is supposed to have all the same features but payment for a license is needed so that's a big no no no.
I just improved the documentation for TableView, so I might be able to help.
Custom Adapter is Mandatory. (Much like it is on a more complicated Listview)
Data Models, this is sort of Mandatory BUT depending on your data and as long as you don't want to filter or sort your data then there is a shortcut to not use these. (I have an example that does not use data models as it displays just text Strings)
e.g. In the below Listview Adapter Creation (the Bold highlighted String Object is your single Data Model Type)
ArrayAdapter adapter = new ArrayAdapter<String>(this,
R.layout.activity_listview, dataArray);
Layouts at least one is Mandatory for a very basic layout but 3/4 layouts are required to have a reasonable looking table (Row Header, Column Header, Cells and optionally Corner)
Your data models are just POJO classes, so you can place them anywhere you want in your projects java source directories. But for better structure you might want to place them in there own sub package.
As for
I have no idea of how to link them up for my ListView to work.
This does not link to a Listview widget, it could replace a ListView widget but more commonly replaces GridLayout, TableLayout or the Grid Layout Managers of a RecyclerView widget.
The two sample Apps give you a good basis for your code.
I would get familiar with RecyclerViews first as a step up from ListViews (as this is really just a complicated RecyclerView)
If you are still struggling then ask another question with details of what data you have and how you want it laid out in the table cells.

Whats the best way to put a customized scrollable list in android studios?

I'm trying to make a android app with a scrollable list like this one...
When I made this app in iOS, I used a UICollectionView. What`s the best way to make this in android studios?
I tried using a list view, but I can't seem to customize it to my needs?
Any Ideas?
ListView was a great way to start and it is customizable to your needs.
However I would recommend to use RecyclerView which works almost on the same principle as ListView but it is a newer concept in Android. It handles the usage of the ViewHolder pattern for you which makes everything super easy.(With ListView, you would've had to implement your own ViewHolder pattern)
All you need to do is to have the RecyclerView in your activity/fragment as the view to hold your data. Then, the key component is to implement the RecyclerView's Adapter which will handle the inflation and setup of each list item.
Here is a really great and short tutorial to get you started with RecyclerView.
If you're done with that here is a bit more advanced video material on RecyclerView from Dave Smith explaining a lot of ways on how to understand and use RecyclerView in your apps.
A ListView fed by an ArrayAdapter of custom objects can do the job.
You might have a class that contains the text and the image of a single item.
Then you can create an ArrayList with items of that class, where you put in all the data.
This ArrayList can be used as dataset for a custom ArrayAdapter, which overrides the getView()-method.
The getView()-method must inflate the xml-layout for each item and attach the data from the ArrayList to the inflated view.
You might want to implement the Viewholder-pattern to achieve a good performance and avoid unnecessary inflations and getViewByID()-calls.
You can also use the new CardView, which can make it a lot easier, since it is made for the new material design in android 5, which looks similar to your item list.

How to create custom Spinner?

I am creating a custom Spinner in Xamarin.Android with text and image. I've created the Spinner in Xamarin but don't know how to customise it.
For example how do I create rounded corners and with customised text and image?
Can anyone tell me how to achieve this? I was not able to upload the screen shot of what i have done so far since my reputation is low.
It is done exactly the same way as in Native Android development. You need to implement a custom Adapter to fill the Spinner with Views that live up to your requirement. Such an Adapter handles which View is shown when and at which position. It handles inflating these Views and populating them with the correct data.
As for styling the Spinner, it is done through the Styling system that Android provides. Which is not specific to how Xamarin.Android (or MonoDroid) does it.
You need to look into the documentation about Custom Adapters, read Creating Custom Row Layouts (in this case they are for ListView, but can easily be adapted to Spinner by overriding and implementing the GetDropDownView) and Spinner

Display a 2d array of buttons in android

I made a subclass of button called Block for a minesweeper like game. I then made a 2d array of this class. Is there an easy way to display this array in a grid?
Thanks
You should use a GridView with a custom adapter. There is enough documentation available at
the Android developer website
Here is a tutorial for a custom adapter. The tutorial uses a ListView, but the adapter will also work with a GridView

Android custom listview inside a window

i'm a complete beginner in android so i don't know how to explain it correctly,can anyone tell me how to create a custom listview inside another layout(i've seen tutorials showing how to make custom listviews out of xml files,in which they sets the contenview to the xml files and i couldn't find any tutorial to create a listview which already has other elements) ,what i'm trying to create is a windows with two listviews. When i click an item in the main listview the sub listview shows up which has a TextView, a rating bar and a button along with the itemname,
almost like this image
http://www.zdnet.com/i/story/60/01/054426/zdnet-box-playbook-listview.png
i believe you all understand what i'm trying to create
If what you want to do is a split view window with two diffrent Listviews that the one can pass data to another or update it in some way you need to take a look in List Fragments. There is a nice tutorial here : http://www.vogella.com/articles/AndroidFragments/article.html

Categories

Resources