0

I have tried How to change spinner text color to no avail.

I am trying to change the text color in a Spinner element.

Array adapter:

ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
            android.R.layout.hour_spinner, hourList);

hour_spinner:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="20sp" />

Intellisense does not recognize the R.layout.hour_spinner

It is the layout folder. Any idea why the hour_spinner is not found by the code?

Community
  • 1
  • 1
andrewb
  • 2,995
  • 7
  • 54
  • 95

2 Answers2

2

This is the reason for your issue ...

R.layout.* are layouts you provide (in res/layout, for example).

android.R.layout.* are layouts that ship with the Android SDK.'

As Milanz suggested, try without android

Prem
  • 4,823
  • 4
  • 31
  • 63
1

Try without android:

ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
            android.R.layout.hour_spinner, hourList);

replace with:

ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
            R.layout.hour_spinner, hourList);

if it doesn't help , give us more codes.

MilanNz
  • 1,323
  • 3
  • 12
  • 29
  • when you call R.layout.hour_spinner , you call your custom layout. When you call android.R.layout.hour_spinner , it's android's layout. – MilanNz Jan 06 '15 at 22:49