I have a Spinner, where the user should select their gender: So far everything works fine, however I need to leave a hint spelled the word sex in the spinner component, as in the image below:
CodethatIhavesofar:
<Spinnerandroid:id="@+id/spinner_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/edittext_email"
android:layout_marginTop="6dp"
android:layout_marginLeft="23dp"
android:layout_marginRight="23dp"
android:entries="@array/spinner_genre_items"
android:textColor="@color/h_gray"
android:textColorHint="@color/h_gray"
android:textSize="@dimen/h_three"
android:fontFamily="sans-serif-medium">
</Spinner>
Array with Spinner items:
<string-array name="spinner_genre_items">
<item>Masculino</item>
<item>Feminino</item>
</string-array>
Java:
private Spinner mSpinnerGender;
mSpinnerGender = (Spinner) findViewById(R.id.spinner_sex);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.spinner_genre_items,
android.R.layout.simple_spinner_dropdown_item);
adapter.setDropDownViewResource(
android.R.layout.simple_spinner_dropdown_item);
mSpinnerGender.setAdapter(adapter);
How could I do this?