Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - Styling Spinner within TabView
    primarykey
    data
    text
    <p>I've got an app that uses tabs for navigation, and on one of those tabs there is a spinner. However, when the spinner is selected and the actual select window comes up, all the text is white on a white background. I've tried styling the layout but nothing I do changes the color of the font.</p> <p>the main class</p> <pre><code>public class RealmsOfWickedry extends TabActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab); TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost); TabSpec firstTabSpec = tabHost.newTabSpec("tid1"); TabSpec secondTabSpec = tabHost.newTabSpec("tid1"); firstTabSpec.setIndicator("Home").setContent(new Intent(this,FirstTab.class)); secondTabSpec.setIndicator("Catalog").setContent(new Intent(this,SecondTab.class)); tabHost.addTab(firstTabSpec); tabHost.addTab(secondTabSpec); } public static View makeSpinner(Context context) { View v = LayoutInflater.from(context).inflate(R.layout.spinner, null); Spinner spinner = (Spinner) v.findViewById(R.id.spinner); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(context, android.R.layout.simple_spinner_dropdown_item); adapter.add("Item 1"); adapter.add("Item 2"); adapter.add("Item 3"); adapter.add("Item 4"); spinner.setAdapter(adapter); return v; } } </code></pre> <p>the class with the spinner</p> <pre><code>public class SecondTab extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* Second Tab Content */ TextView textView = new TextView(this); textView.setText("Choose a Category"); setContentView(textView); setContentView(RealmsOfWickedry.makeSpinner(getParent())); } } </code></pre> <p>tab.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TabHost android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost"&gt; &lt;LinearLayout android:id="@+id/LinearLayout01" android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent"&gt; &lt;TabWidget android:id="@android:id/tabs" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt;&lt;/TabWidget&gt; &lt;FrameLayout android:id="@android:id/tabcontent" android:layout_height="fill_parent" android:layout_width="fill_parent"&gt;&lt;/FrameLayout&gt; &lt;/LinearLayout&gt; &lt;/TabHost&gt; </code></pre> <p>spinner.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;Spinner android:id="@+id/spinner" android:layout_width="fill_parent" android:layout_height="wrap_content" android:prompt="@string/cat_prompt" android:theme="@style/DropdownStyle" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>themes.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;style name="OverallStyle" parent="@android:Theme.Light"&gt; &lt;item name="android:windowBackground"&gt;@drawable/bg&lt;/item&gt; &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt; &lt;/style&gt; &lt;style name="WelcomeStyle" parent="@android:Theme.Light"&gt; &lt;item name="android:typeface"&gt;monospace&lt;/item&gt; &lt;item name="android:gravity"&gt;center&lt;/item&gt; &lt;/style&gt; &lt;style name="CustomStyle" parent="@android:Theme.Light"&gt; &lt;item name="android:typeface"&gt;monospace&lt;/item&gt; &lt;item name="android:gravity"&gt;top&lt;/item&gt; &lt;/style&gt; &lt;style name="DropdownStyle" parent="@android:Theme.Light"&gt; &lt;item name="android:textColor"&gt;@color/red&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>Can anyone help me out with this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload