Show only text on spinner without dropdown - android

i want to show a image and text on spinner & dont want to see the dropdown, look at the image shown below, like this need to have text and image. i.e image at left side and text at right end. Also we require selection happening on the spinner.
Eg: If i click on setDate the calender should come and chosen date should sit on spinner.

just add following line for disabling spinner:
spinner.setClickable(false);
and for selecting your row you can use following code:
spinner.setSelection(spinnerPosition);
that spinnerPosition is that position that you want.

Related

Special first item for android spinner

I need to make a spinner like on picture below. My question is - how to add arrow(dropdown hint) to right part for first element in spinner. Better if it(I mean arrow but not "Select test") will disappear after user press it
Add in spinner arraylist zero position as "Select Type" and you want to add arrow So,you need to take image view in right side of your spinner,and when you get spinner item selected position is 0 at that time you need to visible imageview and other position hide imagview.
I hope this can help you!
Thank You.

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

Spinner dialog click outside text

I'm using a custom Spinner in a dialog mode. Each item element has one text. The text in each item line is very short, eg. "A", "AB", "BC", etc. In order to select a line I have to click exactly the text (the background is than changing into blue and the item is selected correctly). When I click outside this short text but in the item line it is not selected. Is it possible to force the selection when I click the item line not exactly the item text?
If you are using a custom spinner then you should be able to access the textview element in the xml for the class.
In this xml, the textview element try changing the property
Android:layout_width="match_parent"
You may also use the padding and margin to adjust the same.

Set image as first element in spinner

I want to set image as first element in spinner without any text and then other options as text. I have googled a lot but didn't get anything. What I am getting is either image and text with all options or text only.

Android Spinner with no selected text - arrow only

I would like to create a spinner which only displays the drop-down arrow and not the selected value and is only the width of the arrow. You can see various examples of this in Android itself e.g. Settings->Display->Brightness (Edit: a commenter has pointed out that this is a DialogPreference, but I would like a similar effect using a spinner).
I have attached to the setOnItemSelectedListener event and set the selected text to null, but this does not decrease the width of the spinner and you can can briefly see the selected text flicker before it is set to null.
How can I do this with the spinner? Is the spinner the correct control to be using in the first place?
Thanks.

Categories

Resources