my question is how can i set a maximum size of a spinner.i checked solution but they were with xml file.But i want to set spinner size manually by java-code. Can any one help??
Asked
Active
Viewed 556 times
0
-
follow this url it would be helpful http://stackoverflow.com/questions/11920754/android-fill-spinner-from-java-code-programmatically – Ajit Kumar Dubey Apr 24 '14 at 11:34
2 Answers
0
Cant exactly remember but you can use one of the following methods: public void setDropDownWidth (int pixels)
,public void setMinimumHeight (int minHeight)
,public void setMinimumHeight (int minHeight)
.Use them with your spinner like: sp.setDropDownWidth(your pixel value)
.
Also you can implement your own spinner like this.
Also you can copy the Spinner class and modify it.The Spinner Class is here.

kgandroid
- 5,507
- 5
- 39
- 69
0
After API level 16 you can use,
spinner.setDropDownWidth(desiredWidth);

Akanksha Hegde
- 1,738
- 11
- 14