1

I want to change text color in my Alert Dialog.I use text from array.xml.I want this orange color shape in my pic , textcolor change into White color. here is my array.xml file code :-

<resources>
<array name="bug_type">
    <item>
        {"id":\"1\", "type":\"Wrong Question\"}
    </item>
    <item>
        {"id":\"2\", "type":\"Wrong Answer\"}
    </item>
</array>

Here is my Activity data :-

AlertDialog.Builder(this, R.style.popuptheme)
            .setTitle("Select bug")
            .setPositiveButton("Ok") { dialog, whichButton ->
                if (bugTypeDialog.selectReportBugType.checkedRadioButtonId > 0) {
                    postBugReport(bugTypeDialog.selectReportBugType.checkedRadioButtonId.toString(), que_id)
                }
                Toast.makeText(this, "Bug Request has been send ..", Toast.LENGTH_LONG).show()
                dialog.dismiss()
            }
            .setNegativeButton("Cancel") { dialog, whichButton ->
                dialog.dismiss()
            }
            .setView(bugTypeDialog)
            .create()
            .show()
}

I want all textview in white color like orange color shape in this pic Click here for show Bug image

2 Answers2

0

You need to create a theme for the alert dialog. Check this out:

http://blog.supenta.com/2014/07/02/how-to-style-alertdialogs-like-a-pro/

0

Create a textColorSelector in your drawable

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:color="#0f0"/>
    <item android:state_checked="true" android:color="#fff"/>
    <item android:color="#00f"/>
</selector>

Apply this selector to your RadioButton.

<RadioButton
      ...
      android:textColor="@drawable/textColorSelector"
      />
Brijesh Joshi
  • 1,817
  • 1
  • 9
  • 24