i tried a lot to change the dropdown item height of spinner.. but i couldn\'t get a good solution.. plz help me guys..
here is a code loginactivityview.xml
Got stuck in same problem.Found following solution to be working for me:
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
setSpinnerDropDownHeight()
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mBinding?.included?.spinn?.getViewTreeObserver()?.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN)
override fun onGlobalLayout() {
mBinding?.included?.spinn?.dropDownVerticalOffset = mBinding?.included?.spinn?.getDropDownVerticalOffset()!! + mBinding?.included?.spinn?.getHeight()!!
mBinding?.included?.spinn?.viewTreeObserver!!.removeOnGlobalLayoutListener(this)
}
})
mBinding?.included?.spinn?.dropDownVerticalOffset = 10
}
}
Hope it helps someone!!!!
Thanks