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
Related
I am working in one project in which i need spinner which include list of country for selection. when user click on country selection box i want to make a spinner like right to left slider shown in below image. so user can select any country from this slider type spinner.
How can i implement this type of custom spinner?
I know how to implement custom spinner by making a custom layout for spinner but i don't have idea how to implement this type of spinner.
Thanks in advance
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.
I have used Spinner in my XML file. It is working fine. When I click on the spinner, it shows a list of items for that spinner, but the size of dropdown list is so large which covers the whole screen. That's why it doesn't look good. So I want to know how I can set the width and height of the dropdown list so that it would look better.
I have no idea to solve your problem directly,but you can do these steps:
Create a layout(for example LinearLayout) that seems look like spinner widget(before user click on spinner).
Create an activity with theme semitransparent or dialog and put a layout that is look like list for selecting spinner items and user sees it when clicked on spinner.
Add your quasi spinner layout to your UI.
Register a Click-listener for your quasi spinner,so that when user clicks on it,sees activity that contains list for selecting(start this activity for result,when user clicks your quasi spinner).
I have a spinner that acts like a filter for searching among several categories. But the problem is that the spinner allows only one category to select from. Is there a way to obtain a multiple selection behavior for the spinner, or what other alternatives exists?
S spinner is designed to show one item at a time. You might get away by making a spinner of checkboxes, but it will be probably an awful user experience.
I would suggest you a ListView instead and CHOICE_MODE_MULTIPLE. You can add a listview to a dialog as shown in this answer: is it possible to create listview inside dialog?
Android provides Spinner widget which has functionality similar to drop-down list. But Spinner accepts single selection. so we select only one item at a time.so We can achieve multi-select feature using a custom Pop-up Window with a multi-select list.
Pop-up window is similar to Dialogs except that a pop-up window can be positioned.
When the drop-down button is clicked a list will be displayed(as drop-down), then you can select multiple values. The selected values will be displayed in a Text box above the list.
for reference you can prefer this link:
http://asnehal.wordpress.com/2012/04/03/multi-select-drop-down-list-in-android/
I want to display a list item that says "More" at the end of my ListView. Clicking on this list-item will perform some action. How can I create this "more" list item?
I don't know about the "Clicking on this list-item will perform some action" part. The typical pattern is that once the user scrolls to the bottom, new material is loaded automatically. Some people do that by detecting the scroll. I do it by putting in a "More" placeholder and detecting when that is used. Here is a component that implements this pattern.
Just add another value to your arrayadapter (or any other adapter), you might be using.set the text to 'more' .
Suppose you have n items in the list then handle the (n+1)th postion click and do your stuff.
You can add a footer to your listview...
Did you check this post out?
Android ListView Footer View not being placed on the bottom of the screen