how to limit the height for a spinner dropdown list?

How should I go about limiting the height of a spinner drop down ?
Suppose for example:
If I have a spinner drop down with total of 10 rows,
I would like to display only the first 3 rows,
and the rest of the content should be scrollable.


  • RishRish USMember

    can someone help me out here?

  • same issue here

  • YkshLeoYkshLeo USMember ✭✭✭✭
    edited February 2016

    Try this :

    Make use of Reflection

    Spinner spinner = FindViewById<Spinner> (Resource.Id.spinner1);
    try {
        Java.Lang.Reflect.Field popup = spinner.Class.GetDeclaredField("mPopup");
        popup.Accessible = true;
        // Get private mPopup member variable and try cast to ListPopupWindow
        var popupWindow = (ListPopupWindow)popup.Get(spinner);
        // Set popupWindow height to 500px
        popupWindow.Height = 500;
    catch (Exception ex){
        // Failed...

    Refer :

  • That didn't work out for me @YkshLeo .
    The spinner dropdown i want to show , is of "dropdown" style and not "dialog".

  • TroelsThistedTroelsThisted DKMember ✭✭

    depends on how many items you got in your spinner i guess and how big the spinner items are?

  • RishRish USMember

    @TroelsThisted . I just want to show max. 3 or 4 items at a time and rest of the items should be scrollable.

    For example: If i have a total of 10 items in the dropdown, then
    Only the 4 items should be visible at a time in the dropdown , and the rest of the 6 items should be visible on scrolling down.

  • RishRish USMember

    @YkshLeo thanks for the code sample using reflection , but it didn't work .
    Is there any other way that can make it work?

  • DarrenLukasDarrenLukas USMember ✭✭

    @Rish Hi Rishi, did you have the solution for this? I am also facing the same issue here.

  • bludyvenombludyvenom INMember

    I'm no pro but after thousands of tries, here's the ultimately simple solution...
    just copy this line in Spinner tag...

    android:dropDownHeight="100dp"    <!--change 100dp to your requirement-->

    you can also modify width...

    android:dropDownHeight="100dp"   <!--change 100dp to your requirement-->

    and you know what it works on autocompletetextview too and with atleast api 16...

  • xama.mxama.m USMember ✭✭
    Can you tell me how did you solve this issue?It would be very helpful to me
  • xama.mxama.m USMember ✭✭

    @ YkshLeo var popupWindow = (ListPopupWindow)popup.Get(spinner); is returning nul?

    you do have any idea..can you plz help me on this

  • MizanurRahman.0834MizanurRahman.0834 USMember ✭✭

    You can use dropdown height as follows


    And test if it fits with your 3 to 4 items or change the value to 150dp or other.

  • SanjuSanju Member ✭✭

    hello Rish ,
    Did you find the soution of this quesiton ??

Sign In or Register to comment.