How to create spinner with heading in it? - android

I am just thinking to create like below in spinner, but i am not sure how to make it work
Fruits (heading unclickable)
Apple
Mango
Orange
Cars (heading unclickable)
BMW
Lenova
Is that possible in Spinner or if you know any other method to create like this, then it would be great.
I am getting those details from the local database. Heading from one table and records from one table.
I am looking for any example or solution.
Thanks for your help guys.

After long time i found a way to do this. I achieved by combining a Button and Expandable ListView. What i have done is i created a button like spinner. OnClick I launched a popup Activity with Expandable list view in it by calling startActivityForResult() which returns the selected value. Finally i replaced the button text with the selected value.
If you looking for Expandable ListView Tutorial you can click below link.
(http://androidtrainningcenter.blogspot.co.uk/2012/07/android-expandable-listview-simple.html).

Take a look at the Spinner example in the Hello Views tutorial. They accomplish this by using a TextView for the heading, and the spinner for the selectable list of options.

Related

ArrayAdapter.createFromResource() and ArrayAdapter. setDropDownViewResource()

Could someone please help point out the difference between the the two parameters that I highlighted. Aren't they the same thing, the layout resources used to create each view (or item) in the dropdown list? What does the ArrayAdapter.setDropDownViewResource() do exactly?. Thank you very much for your time. Any help is greatly appreciated.
When you are using Spinner or AutocompleteTextView you use setDropDownViewResource to identify which layout should be used to create drop down list items view.
But the first parameter identifies the layout that should be used to create view for selected item from drop down list.
Note: As I experienced, the last point is correct in Spinner, not in AutoCompleteTextView. Because AutoCompleteTextView is an EditText itself.
You can read more about Spinner and AutoCompleteTextView

How to access cutom listview with checkbox in dialog Android?

I had a custom listview with checkbox in alert dialog. I want to access the row with selected checkbox on Done button click. Here is the screen short of the image.
Here I'm using hash map both arguments string with custom list
Thanks in Advance
One way could be set a listener to your CheckBoxes and add/remove the row (object, view or whatever you need) to a list when the check changes.
Another way to achieve this could be to iterate over your rows and see if the CheckButton is checked or not. But this choice won't be good in performance if you have too many rows.

Dropdown list like Spinner in Android

I am trying to implement a dropdown list that looks like the web drop down list.. But what i could implement was only the spinner which can select an item but it doesn't give the idea of drop down..anyone who knows a work around it?..
Thanks in advance.
Web like drop down means, do you think about like lable on top "Select Value" and below a list of values ?
If yes then you can do it by creating a custom Spinner. Just create a lable, on click of it open a Dialog and bind list values to the dialog. So it will behave completely same as Spinner.
Hope it helps
Create a dummy button similar like dropdown. Just below it use invisible/gone scrollview. Inside scrollview use listview. On click, make it visible.

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

How can I create an order form?

I am new to Android, and am trying to develop an app that presents a list of choices with a textfield next to each that allows the user to enter in quantity information related to each item.
What would be the best way to impliment this? Currently my app is using a buttonlist with checkboxes next to each item to select it. I'd like to expand this so that I can select multiples of the same item.
Any help is appreciated.
Thanks,
Jason
I'd use a Spinner for the item and an EditText for the quantity.

Categories

Resources