How to set a textview's background color to be holo green light via XML?

Via Java:

TextView test = (TextView) view.findViewById(R.id.textView2);
test.setBackgroundResource(context.getResources().getColor(android.R.color.holo_green_light));

Via XML:

 <TextView
        android:text="2"
        android:textSize="200sp"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/textView2"
        android:style="@style/textviewStyle" 
        android:background="@android:color/holo_green_light"
        android:gravity="center"
        android:textColor="#EEEEEE"
        android:layout_alignParentRight="true" />

This is the API page about this topic


android:background="@android:color/holo_green_light" seems to work for me. Your target API version does include the Holo theme, right?

Tags:

Android