2

I Have a Spinner(Dropdown) that holds 50 rows in it, as well contains Approximately more than 160 characters in every row, the issue is prefix till 20 characters is same for all, my question is that how can i make this spinner vertically scrollable (default) and Horizontally as well.

so that i can see whole the value of the rows.

1 Answers1

1

Create custom Layout with TextView Horizontally Scrollabal like below

custom_spinner.xml

 <TextView
        android:id="@+id/textView1"
        android:text="Scrollable Text" 
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit ="marquee_forever"
        android:focusable="true"
        android:focusableInTouchMode="true" 
        android:scrollHorizontally="true"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"/>

Then set custom Layout to your Adapter class (may be custom or any other like ArrayAdapter)

ArrayAdapter your_Adapter = new ArrayAdapter(this, R.layout.custom_spinner,your_array);
your_spinner.setAdapter(your_Adapter );
Mr. Roshan
  • 1,777
  • 13
  • 33