Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android spinner full screen view

I have a form in a DialogFragment that includes a spinner. I don't think I can port the spinner options out to a new activity (e.g. customisable ListView etc.) as it will close the DialogFragment, so I'm using the spinner embedded into the DialogFragment (screenshot 1). There is nothing unusual about how I'm populating the spinner with an ArrayList and adapter.

<Spinner
    android:id="@+id/breedingcodes"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="10dip" />

Functionally it works fine and the spinner options appear and are selectable, but looks terrible as it only uses half the screen (see screenshot 2), anchored to the position of the spinner in the DialogFragment. Is there anyway to force it to use the full screen, as in the 3rd screenshot with Breeding evidence title? I've tried fiddling with layout_height="match_parent" etc. - no joy.

App is developed for min SDK_10, compiled for SDK_23, build tools 23.0.3.

Form in DialogFragment Sub-standard spinner view Full screen spinner view

like image 962
iaindownie Avatar asked Jul 05 '16 09:07

iaindownie


1 Answers

You can either create your own dialog and style it as you want, or just use

android:spinnerMode="dialog"

as attribute in spinner. See docs here

like image 108
Silwester Avatar answered Oct 27 '22 21:10

Silwester