How to show Spinner With Label (Static Text)?
for this you will have to create custom spinner:
layout of spinner according to your need name it as custom_spinner
:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tVStaticSmallLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="static text"
android:textColor="#777777"
android:textSize="22px" />
<TextView
android:id="@+id/tVMainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tVStaticSmallLabel"
android:layout_marginTop="5dip"
android:text="your changing text" />
</RelativeLayout>
in activity give this layout to the spinner:
Spinner mySpinner = (Spinner) findViewById(R.id.yourSpinner);
mySpinner.setAdapter(new MyAdapter(this, R.layout.custom_spinner,
spinnerValues));
That title is nothing but a TextView.