Is there a way to scroll spinner's dropdown list to top so first item is visible regardless which item is currently selected?
Obviously I need only to make vistible the item in the list without any selection.
ListView has smoothScrollToPosition() method to display a specific item in the list but spinner seems not to have a similar behavior.
Related
I want to make custom spinner in which user can select one of the items on dropdown list (like in normal spinner) but I want to prevent from closing (collapsing/dismiss) dropdown list after item selection. Or closing dropdown when user tap two times on item instead of single tap. Is anyone here knows how to achive such behavior using spinner?
Set itemSelectedListener on your spinner and onItemSelected() run this code
spinner.setClickable(false);
I have a spinner where I am adding hint at the bottom(not adding to top as getSelectedItemPosition will consider the hint as well) using arrayadapter hiding it from showing on dropdown options. The problem I am facing is, if I make the hint to show for the first time by using setSelection, then drop will directly go to bottom of the list(though hint won't show). Is there way that the dropdown will always show the top item on dropdown list irrespective of what item I select previously?
Following situation: I have a ListFragment, if you click on a list item of it some views inside the list item gets visible, so the list item itself gets expanded. Now, imagine the pressed list item is the last in the list, the expanded part won't be visible. Is there a way to achieve that the list scrolls down a little bit so the complete list item is visible?
Try this: yourListView.scrollTo(0, yourListView.getHeight());
I have list view which lists out items and I have disabled the touch on selection too. I have a button - when I click on next the second item in the list is selected but there is no graphical way to show that the second item is selected?
Is there a way to do so?
I have a list view in android. And in each list item, user can expand/collapse when click on that list item. My question is how can I make the list view scroll to make the whole list item visible to user as I click the last item item which causes the last list item to expand and hence the list item increase its size (height)?
And same thing goes for when I click the list item to make the list item collapse (which makes it reduces its size)?
Thank you.
You could use:
listView1.smoothScrollToPosition(int position);
Or
listView1.smoothScrollByOffset(int offset);