Android Alert Dialog replace default blue with another color -


I am using a single option warning dialog in which I want to change the default blue color (headline and radio button) I'm using in the title bar that for the orange I could change the title bar using the setCustomTitle () , but I'm trying to get rid of this blue color.

For the title bar

   & Lt; / LinearLayout & gt;   

Creating alert dialogs

  AlertDialog Builder Builder = New AlertDialog Builder (main activity.); See custom-cutle = seeinstet (main activity., R.Let.CustomMelt_light_title, empty); Builder.setCustomTitle (customTitle); Builder.setSingleChoiceItems (mAlertOptions, -1, New DialogInterface.OnClickListener) {@Override Public Zero onClick (DialogInterface dialog, integer which) {// stuff dialog.dismiss ()}}}}. () Create show ();   

This is what it looks like

 Enter image details here

I have to get rid of this blue color! << Div>

The only way to change the title divider color is resources.getIdentifier Combination, Window.findViewById . You can easily change the checkmark by calling AlertDialog.Builder.setSingleChoiceItems (ListAdapter, int, OnClickListener) .

Single option item layout : I have generated your_radio_button using

  & Lt; Checked textview xmlns: Android = "http://schemas.android.com/apk/res/android" Android: ID = "@Android: ID / Text1" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" Android: Right mark = "@ drawable / your_radio_button" Android: Ellipsize = "Marquee" Android: Gravity = "center_vertical" Android: minHeight = "Android: attr / listPreferredItemHeightSmall" Android: paddingEnd = "16dip" Android: paddingStart = "16dip "Android: Text Appointment =" Android: ATR / Text Experience Yum "android: text = client"? Android: ATR / Tekstcolrelitdayloglistaitm "/ & gt;   

Implementation

  Last ListAdapter Adapter = New ArrayAdapter & LT; String & gt; (This, R.layout.select_dialog_singlechoice, android.r.id.text1, new string [] {"option1", "option2"}); Final AlertDialog.builder Builder = New AlertDialog.Builder (this); Builder.setCustomTitle (getLayoutInflater () .Fullo (R.Lateout_Lert_title, empty)); Builder.setSingleChoiceItems (Optimizer, -1, New DialogInterface.OnClickListener () {@Override Click Public Zero (DialogInterface dialog, int which) {// do something}}); // AlertDialog Show the final AlertDialog dialog = builder.show (); // The last resource resource that divides the title = res = getResources (); Final Ent TitleDidderID = Reset. Deliverifier ("title dividers", "id", "Android"); Title titleDivider = dialog.findViewById (titleDividerId); TitleDivider.setBackgroundColor (res.getColor (android.R.color.holo_orange_dark));   

Result

 Example

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -