2016-05-14 9 views
0

私は、押したときにラジオボタンが持つ醜いピンクの色を変更しようとしています。私はそれを探していたが、誰もそれを行う方法について適切な答えを持っていないようだ。あなたは私にスタイルを勧めたり、プログラムでそれをやりますか?ラジオボタンの円と点の色が選択されている

これはラジオボタンの私のxmlレイアウト:

<RadioGroup 
    android:layout_width="200dp" 
    android:layout_height="250dp" 
    android:id="@+id/radioGroup" 
    android:orientation="vertical" 
    android:layout_above="@+id/btSig" 
    android:layout_centerHorizontal="true"> 

    <RadioButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="New RadioButton" 
     android:id="@+id/primero" 
     android:layout_marginTop="10dp" 
     android:onClick="pulsado" 
     android:textSize="17dp" 
     /> 

    <RadioButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="New RadioButton" 
     android:id="@+id/segundo" 
     android:layout_marginTop="10dp" 
     android:onClick="pulsado" 
     android:textSize="17dp" 
     /> 

    <RadioButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="New RadioButton" 
     android:id="@+id/tercero" 
     android:layout_marginTop="10dp" 
     android:onClick="pulsado" 
     android:textSize="17dp" 
     /> 
</RadioGroup> 

I want to change that pink color when onpressed. が助けてくれてありがとう!

答えて

0

などでそれを変更することができます。
プロジェクトでは、app>res>values>colors.xmlにアクセスしてください。このXMLファイルには、アプリの色が16進数で表示されます。
ほとんどの場合、<resources>の下に3つのXML値が表示されます。 colorAccentの値は、RadioButtonの選択色を変更します。 enter image description here

+0

ええ、それはすべてを変えますが、私が持っている残りの要素の色を管理する方法は分かります。だからありがとう! –

+0

よかった、うれしかったよ! – AkashBhave

1

あなたはアプリ全体のがあなたのresのフォルダにそれを変更することで、デフォルトのRadioButtonの色を変更する最も簡単な方法そのandroid:buttonTint="#a14545"

コード例

<RadioButton 
     android:id="@+id/rb_mini_layout_selection_word_types_all" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal" 
     android:checked="true" 
     android:text="all" 
     android:buttonTint="#a14545" />   
+0

はい、回答を選択する必要があるユーザーであるため、私はそれらをチェックしたくありません。このようにすることで、円は常に同じ色になり、一度選択すると色を変更したいだけです。ちょうど私が掲示した絵のように。 –

関連する問題