Dropdown list like Spinner in Android - 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.

Related

Android: drop down input with left and right icons

I have an android application with a drop down list which have left and right icon, I try to use spinner with left and right drawable, but does not work, what I need is look like below where user can only enter (select) from the list, which mean autocomplete text is not useful, also dropped list does not contain image, How can I achieve that?
So after better understanding your idea, this is the steps you need.
create a custom adapter (this should take the list of string you want to display and the list of icons )
list item is one edit text like
<EditText
...
android:drawableLeft="#drawable/my_icon" />
create your spinner and set the adapter
Spinner sp = findViewById(R.id.spinner);
sp.setAdapter(your custom adapter)
add the item selected listener and you are done.
More info on adapters
You need to use a custom spinner With Image And Text and a card view back ground for spinner. check this link how to add drop-down menu spinner. https://stackoverflow.com/a/24422359/2546742

Open a menu with a List when I click in a view

I'd like to show a menu when I click in a view (Linear/RelativeLayout) like the images below
Anybody knows how to do it?
Thanks!
The UI-Element you're looking for is called a Spinner (Docs). As far as I know the default implementation of the Spinner/Dropdown-List displays only text without any kind of drawable (circle) like in your screenshot.
So what you have to do is to create you own layout and Adapter for the Spinner.
The view you are looking for is called Spinner. Android has excellent documentation about this subject.
If you want the spinner to go up, like in your picture, you will have to place it at the bottom of your view, since it will only go up if there is no room below
You should use the Spinner view
If you would like to customize the view elements, than you should change the default ArrayAdapter to yours and override the getView() method.

Need a spinner like this

I want to add a spinner in my app like the below image. Actually this drop down spinner should contain contents which can be selectable and also section headers which cannot be clickable. Some advise to use section in listview, others expandable view.
But nothing helps .. Please some on help me to complete this.
Check this https://code.google.com/p/android-section-list/ this can be helpful..
You'll need to set a Custom dropdown resource to the Adapter which is set to the Spinner and also you'll need to have a custom Adapter which will setEnabled() certain items like "View As" and "Sort By" to false.
EDIT:- it's isEnabled() and not setEnabled().. my bad!

How to add elements to expandable menu?

I want to have an expandable menu, and when you expand a child item, then it will show some custom items, items of my choice, like a text input field or a checkbox (see the image below).
Now how can I achieve that? Can I achieve that using the Eclipse GUI builder? Or do I have to create methods where the data is loaded dynamically?
UPDATE:
So I do not only want text items as child elements, but all sorts of elements, like an input field or checkbox.
This tutorial works like charm
http://myandroidsolutions.blogspot.in/2012/08/android-expandable-list-example.html
i also took code from here to make my custom expandable UI by implementing adapter

How to create spinner with heading in it?

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.

Categories

Resources