Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there no prompt in the Android 4.x spinner anymore?

I'm new to Android development and found that I can setup a android:prompt attribute to a Spinner widget. Like so in my layout/my_layout_fragment.xml:

<Spinner
    android:id="@+id/boxFunction"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_column="0"
    android:layout_columnSpan="2"
    android:layout_gravity="left"
    android:layout_row="14"
    android:entries="@array/function_options"
    android:gravity="fill_horizontal"
    android:prompt="@string/function_prompt" />

I found several screenshots from the Android 2.x epoch which clearly shows the prompt, but I haven't had any luck finding any 4.x screenshots which shows me the prompt. And my compiled app on Android doesn't show it either.

Was the prompt deprecated in 4.x (and if so, where can I get the deprecated information)? Or did I miss something?

like image 707
Jens Kohl Avatar asked Dec 14 '12 10:12

Jens Kohl


1 Answers

I don't think it is deprecated. Maybe from 4.0 it depends on another attribute called

android:spinnerMode

Here is a example which shows you how the prompt works with Spinner Mode attribute.

And before that let me make it clear that,spinnerMode can be set to either dialog or dropdown.

<Spinner  android:layout_width="wrap_content"
    android:id="@+id/spinner"
    android:layout_height="wrap_content"
    android:prompt="@string/app_name"
    android:spinnerMode="dialog"/>



<Spinner  android:layout_width="wrap_content"
    android:id="@+id/spinner1"
    android:layout_height="wrap_content"
    android:prompt="@string/app_name"
    android:spinnerMode="dropdown"
    android:layout_below="@+id/spinner"
    />

As you can see the first spinner has the spinnerMode set to dialog and the next spinner set to dropdown.

here are the outputs,

Dialog Mode

enter image description here

drop Down

enter image description here

The prompt title I have used here is "Locale Test". Thought I have set it to both the spinners it is visible only in Dialog Mode spinner. So I think it speaks for it.

like image 151
Andro Selva Avatar answered Nov 25 '22 17:11

Andro Selva