Code example for CheckedTextView

Methods: setBackgroundColor

0
            { 
                // Find the text view from our interface 
                CheckedTextView tv = (CheckedTextView) view.findViewById( android.R.id.text1 );
  
                // Color the text view background using our color 
                tv.setBackgroundColor( m_colors[position] );
            } 
  
            return view;
        } 
    } 
  
    public ColorPreference( Context context, AttributeSet attrs )
    { 
        super(context, attrs);
  
        // Here you should fill up the m_colors array with the colors you want to use. You can either 
        // have a static initializer, or read the array from resources. 
        m_colors = new int[10];
        m_colors[0]=Color.YELLOW;
        m_colors[1]=Color.MAGENTA;