Spinner with scrollbar - android

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

Related

The first button in a gridView of buttons is not changing colour

I am unable to get the first button in a gridView to change colour. The button works fine, and it operates as normal when it is clickd but it wont update the colour of the first button. I am using a custom list adapter to generate the gridView. This only seems to happen if I want to change it in real time, if i load the buttons at a later stage the buttons do change colour. I've tried to hard code it for the first button in the list but that doesn't seem to work either.
In Grid view First you have to create a custom adapter for it and then in the Override method "get View()" you will get the specific cell and then change its background color.
For Details click the link : https://developer.android.com/guide/topics/ui/layout/gridview.html

ListView row with EditText, clickability, and context menu -- how to put it together?

I have a ListActivity-based activity that uses a context menu for the items. After adding an EditText to the row of a ListView, the context menu stopped working, and also the item does not react on a click. It seems that it is blocked somehow by the focus of the EditText. I can enter the EditText value, but I cannot get the earlier context menu, and I cannot start another activity via clicking the item.
I have possibly found the related comment that says:
Android doesn't allow to select list items that have focusable elements (buttons). Modify the button's xml attribute to:
android:focusable="false"
It should still be clickable, just won't gain focus...
... so I did the same for the EditText (I am not sure if the button case can be generalized for the EditText). Anyway, the item is clickable again, the context menu appears... However, the EditText part of the text stopped working now. (Actually, I did not implement the reaction to the EditText -- the keyboard simply does not appear.)
Is it possible to have the clickability of the list item and also make the EditText work the expected way?
I don't know if this would help you but it is a post I've found when I was trying to use a ListView with buttons inside.
ListView Tips & Tricks #4: Add Several Clickable Areas
Hope this helps.

Android Spinner does not close after using setSelection()

I have a scenario where I want to programmatically change the value of my spinner using setSelection(). This works great, except that if the spinner is open (expanded?) an the time, the spinner does not close. Eg, the menu stays up, despite calling setSelection().
How can I programmatically close the spinner? I have tried performClick() to no avail.
edit: more details:
The reason I'm trying to do this is that my spinner actually uses a compound layout for each selection row. Namely, I have a linearlayout which contains an image, text, and button. The idea was that the button serves as an "edit" button (which opens an activity), while pressing on the image/text select the row (per usual).
The problem came when I added the button. Suddenly, the image & text no longer captured the press event to change the combo. In other words, adding a button to the row destroyed the touch-handling capacity of the entire row. So I tried to manually implement a click handler for the image/text, which subsequently executed a setSelection... which is where I ran into this problem.
You say that after adding the button you lost the click handle on the entire row. Try adding this android:descendantFocusability="blocksDescendants" to your row layout, and see if you can get the clicks to work properly.

Spinner items selection radio missing

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).

Listview's first item is always selected

I'm using a custom view to display items in a listview. For some reason every time the list is populated; the first item is shown as selected (ie; orange highlight). I've tried everything I can think about to solve it; any ideas?
I ended up having to request focus from the parent layout.
This would happen when you launch your Activity using the keyboard (you are thus in key mode, which causes the first focusable item to be focused.) How is that a bad thing?

Categories

Resources