How to I tell my own custom Spinner Layout to use my Theme?
Posted
by jax
on Stack Overflow
See other posts from Stack Overflow
or by jax
Published on 2010-05-21T07:53:37Z
Indexed on
2010/05/21
8:40 UTC
Read the original article
Hit count: 337
android
How to I tell my own custom Spinner Layout to use my Theme?
Style:
<style name="SpinnerText" parent="@android:style/Widget.TextView.SpinnerItem">
<item name="android:textAppearance">@style/AnswerTextElement</item>
<item name="android:gravity">center_vertical|center_horizontal</item>
</style>
Theme:
<style name="ApplicationTheme" parent="android:style/Theme.NoTitleBar">
<item name="android:buttonStyle">@style/Button</item>
<item name="android:spinnerStyle">@style/Spinner</item>
<item name="android:spinnerItemStyle">@style/SpinnerText</item>
</style>
This works for default Spinners, however does not work with my custom layout:
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:layout_height="wrap_content" android:id="@+id/text1"
android:text="label name" android:layout_width="fill_parent"
android:layout_toLeftOf="@+id/check1"></TextView>
<CheckBox android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/check1"
android:layout_alignParentRight="true" android:clickable="false"
android:focusable="false" android:focusableInTouchMode="false"
style="@style/CheckBoxPlainBackground"></CheckBox>
</RelativeLayout>
© Stack Overflow or respective owner