Spinner items selection radio missing - android

When my items contains English and/or numeric signs, it shows the radio selection near the item, but when it doesn't contains any English and/or numeric signs (contains only Hebrew in my example) it does not show the radio selection near the item.
For the adapters (array adapter) creation i used the layout "android.R.layout.simple_spinner_item"
And before setting the Spinner adapter I did
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
The solution I found for now, is set the layout to "simple_dropdown_item_1line"; this solves the problem by not showing the radio button.
Any ideas on how to get the radio button visible always?
correction - the solution does not work. for few of my spinners it shows a white text on a white background.

Hi the below code works for me in hebrew
For the Adapter use android.R.layout.simple_spinner_item
and myAdapter.setDropDownViewResource(android.R.layout.select_dialog_singlechoice);
Regards,
Yaron

Any ideas on how to get the radio button visible always?
Use an appropriate layout for the drop-down view resource. android.R.layout.simple_spinner_dropdown_item should always work. If you create your own layout, and it does not work, identify where you changed things from android.R.layout.simple_spinner_dropdown_item that would affect matters (e.g., text color, background color).

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

How can I change radio button to contain text and look like a selectable button?

How can I get selectable view on my gridview like this
I have checked some of the suggestions on a few questions but I still am not able to make it work using Buttons. If it is possible with this I still can use it though most suggestions state that you can change the radio button but none shows how. I need mine with text or color or both according to the category. Only one view in the grid can be selected.
You may consider customising your radio button by changing the images associated with it.refer this

Spinner with scrollbar

I have a simple spinner with 20 items in it. A scrollbar for same spinner appears by default when launching the application the first time. And afterwards it fades out immediatly. So to select last item in spinner I have to use arrow keys on keyboard.
One more problem with spinner:
android:drawSelectorOnTop="true"
This also doesn't work. I can't see the selector on top.
Customspinner
scrollview
example
example try this also
this may helps you

Custom spinner items not appearing as part of Spinner

I'm running into a problem: when I use a non-trivial type of Spinner item, the Spinner displays the drop-down list someplace other than on the Spinner.
(Note: most of this description is identical to https://stackoverflow.com/questions/4188443/android-doesnt-honor-selection-change-with-custom-spinner-items, but the problem I'm reporting here is slightly different. I've split these up so it's clear where to direct different replies to)
My goal was to have a slightly more fancy display for each item in the spinner, and so I started by creating a layout that contains several items, one of which is the target TextView (lbl2, in this case)
I then attempt to set up the Spinner (my eventual goal is to populate the spinner programmatically, so I'm not using resources to set this up) using:
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(
this, R.layout.spinner_fancy, R.id.lbl2);
adapter.add("Item #1");
adapter.add("Item #2");
adapter.add("Item #3");
spinner.setAdapter(adapter);
When I run the program it looks (mostly) good - the Spinner is, in fact, rendering the goofy-looking multi-color, vertical layout of three textviews for each item, and it's correctly substituting Item #1, Item #2, and Item #3 for lbl2. I can even click on the spinner & bring up the drop-down list of choices.
This problem is that the items aren't displayed over the spinner. Instead they're just kind of floating over the activity, a bit further down. Hopefully this picture will help clarify: Floating Spinner Elements http://www.freeimagehosting.net/uploads/bf9f584156.png
EDIT: Thanks for the vote up - I've fixed up the image so it's now inline!
Android Spinners work in that way... The list of items is shown in "dialog mode".
You can add a title to the list using this in the XML layout (in the spinner section):
android:prompt="Select a fancy item..."

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