0

I am developing an android app and in the activity I have three fields: 1. Mobile number 2. Spinner 3. Spinner

After user enters the mobile number I want to change the color of spinner items.

Can someone tell me how this can be done ? Thanks in advance.

Arpit
  • 604
  • 5
  • 17
  • show some sample image – Rathan Kumar Mar 28 '15 at 10:57
  • possible duplicate of [Change Text color Of spinner items coming after parsing](http://stackoverflow.com/questions/17161125/change-text-color-of-spinner-items-coming-after-parsing) – Heshan Sandeepa Mar 28 '15 at 11:07
  • @DavidJhons : I want to change the color of all the items of Spinner. The link you have shared is changing color for selected item only.. – Arpit Mar 31 '15 at 08:55

2 Answers2

0

You could listen to the onfocuschanged to do that, like in here. Alternatively, you could implement a textwatcher and listen to the ontextchanged event, like in here.

Community
  • 1
  • 1
Filipe Silva
  • 220
  • 4
  • 10
0

Try this :

EditText et = (EditText)findViewById(R.id.editText);

    et.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) { 
              if(count>0)
              {
                    // Set color of spinner item here
              }
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
        @Override
        public void afterTextChanged(Editable s) {
            Log.e("TextWatcherTest", "afterTextChanged:\t" +s.toString());
        }
    });
Darsh Patel
  • 1,015
  • 9
  • 15