Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dismiss Android Spinner drop down list programatically

Tags:

android

I had a scenario where I am using spinner in my app. A made spinner drop down list to open up directly using "performclick()" method . The drop down list is opened. Is there a way in which I can close it automatically or click an item from drop down list automatically so that the drop down list is dismissed.

like image 437
Android_programmer_camera Avatar asked Nov 10 '22 15:11

Android_programmer_camera


1 Answers

Borg8's answer is the only solution that works! Here is my version to add the spinner back.

if (spinner.getParent() == null){
  parent.addView(spinner);
  spinner.setLayoutParams(params);
  spinner.forceLayout();
}
like image 66
John Zhang Avatar answered Nov 14 '22 21:11

John Zhang