I could not change spinner's textsize or colour with the code below:
<Spinner
android:id="@+id/spinner1"
style="@style/submitspinner"
android:layout_weight="2"
android:entries="@array/a_code"
android:prompt="@string/p_code" />
style:
<style name="submitspinner" parent="@android:TextAppearance.Widget.TextView.SpinnerItem">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_margin">10sp</item>
<item name="android:textColor">@android:color/holo_blue_dark</item>
<item name="android:textSize">@dimen/pt</item>
</style>
It looks same, how can I increase textsize and change colour of the spinner?
Via XML Only
Just to help others in case they are statically setting their Spinner entries in XML.
The above answers work if you're creating your Spinner via code but if you're setting your Spinner entries via XML, i.e. using
android:entries
, then you can adjust the text size and other attributes with the following two theme settings:In your res/values/styles.xml
customize your spinner
here is a good tutorial i once used
http://stephenpengilley.blogspot.be/2013/01/android-custom-spinner-tutorial.html
it has everything u need.
also in your 'style' u have:
change it to 10dp
sp = text size
here u can find more about units to measure
What is the difference between "px", "dp", "dip" and "sp" on Android?
What you should do for custom Spinners is create a single XML that will act as your template for the string in the Spinner, like so:
Then when you create your Spinner adapter in java do the following: