2012-06-05 3 views
0

Я не могу изменить цвет текста в моей радиокнопке:RadioButton изменить цвет текста

<RadioGroup 
         android:gravity="center" 
         android:layout_width="fill_parent" 
         android:layout_height="wrap_content" 
         android:orientation="horizontal" 
         android:color = "#000000" 
        > 

         <RadioButton 
          android:id="@+id/contact_yes" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:color = "#000000" 
          android:text="@string/yes" /> 

         <RadioButton 
          android:id="@+id/contact_no" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:color = "#000000" 
          android:text="@string/no" /> 
       </RadioGroup> 

Это всегда белое, и я хотел бы изменить к черному?

Спасибо заранее

ответ

1
android:textColor="#000000" 

или

android:textColor="@android:color/black" 

использование textColor изменить цвет текста

<RadioButton android:id="@+id/contact_yes" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:color = "#000000" 
android:text="@string/yes" /> 
1

Попробуйте это:

<RadioButton 
android:id="@+id/contact_yes" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:textColor="#000000" 
android:text="@string/yes" /> 
0

Вы можете использовать Android: метод TextColor, чтобы сделать это.

Примером может служить андроид: TextColor = "# 00000000"

В # 00000000 два левых бита прозрачно бит. # 00 (прозрачный) 00 (Red Color) 00 (зеленый цвет) 00 (Синий цвет). они являются шестнадцатеричными.

Подробнее о прозрачном бите см. Set transparent background.

Смежные вопросы