Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change position of spinner dropdown list

I need to change the horisontal position of Spinner's dropdown list. here's the screenshot :

enter image description here

and I want this dropdown list to go in one line under the main icon/text so it would look fine

As on the picture :

enter image description here

here's what I do in xml :

<Spinner
    android:id="@+id/tvHeader"
    style="@style/spinner_style"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/ver_main_donate_background_tile_long"
    android:layout_alignTop="@+id/ver_main_donate_background_tile_long"
    android:layout_marginTop="5dp"
    android:layout_toRightOf="@+id/icon_main_header"
    android:spinnerMode="dropdown"
    android:dropDownHorizontalOffset="-15dp"
    android:gravity="left|center_vertical"

    android:text="@string/name_of_product" />

so, as I suppose,

android:spinnerMode="dropdown"
android:dropDownHorizontalOffset="-15dp"

should do the trick, but as you see on the screenshot it doesn't work

like image 506
Vlad Alexeev Avatar asked May 12 '14 13:05

Vlad Alexeev


1 Answers

enter image description here

You can observe that the list items are aligned slight right, from the parent So i added a marginLeft attribute in spinner view

android:layout_marginLeft="20dp"

and thats worked for me, below you can see the difference

enter image description here

like image 69
Abhishek Avatar answered Oct 19 '22 05:10

Abhishek