Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7562745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:29:15+00:00 2026-05-30T13:29:15+00:00

I’ve got a style set up for my Alert Dialog, and the style is

  • 0

I’ve got a style set up for my Alert Dialog, and the style is being shown on [most] of the dialog without issue, the only problem are the buttons.

The phone is an HTC Evo running SenseUI, and the AlertDialog buttons continue to be skinned via the SenseUI theme. I have tried changing my application style (rtg_style) to be a child of Theme.Dialog instead of Theme.Light.NoTitleBar, and the buttons for the activities continue to be styled correctly, but the AlertDialogs also continue to be styled inccorrectly. I’m trying to avoid having to write a completely custom AlertDialog replacement, what else can I do?

styles.xml:

<style name="rtg_style" parent="@android:style/Theme.Light.NoTitleBar">
    <item name="android:windowBackground">@drawable/bluebg</item>
    <item name="android:buttonStyle">@style/rtg_Button</item>
    <item name="android:listViewStyle">@style/rtg_ListView</item>
    <item name="android:expandableListViewStyle">@style/rtg_ExpandableListView</item>
</style>

<style name="rtg_AlertDialog" parent="@style/rtg_style"> <!-- parent="@android:style/Theme.Dialog"> --> 
    <item name="android:buttonStyle">@style/rtg_Button</item>
    <item name="android:listViewStyle">@style/rtg_ListView</item>
    <item name="android:alertDialogStyle">@style/dialog</item>
</style>

<style name="rtg_Button" parent="@android:style/Widget.Button">
    <item name="android:background">@drawable/button</item>
    <item name="android:textColor">#ffffff</item>
    <item name="android:textSize">15sp</item>
    <item name="android:textStyle">bold</item>
    <item name="android:height">40dp</item>
</style>

<style name="rtg_ListView" parent="@android:style/Widget.ListView">
    <item name="android:listSelector">@drawable/listview</item>
</style>

<style name="rtg_ExpandableListView" parent="@android:style/Widget.ExpandableListView">
    <item name="android:listSelector">@drawable/listview</item>
</style>    

<style name="base">
    <item name="android:padding">10dp</item>
</style>    

<style name="title" parent="@style/base">
      <item name="android:textColor">#FFFFFF</item>
    <item name="android:textSize">16sp</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="body" parent="@style/base">
    <item name="android:textColor">#000000</item>
    <item name="android:textStyle">normal</item>
</style>

<style name="dialog">
    <item name="android:fullDark">@drawable/dialog_body</item>
    <item name="android:topDark">@drawable/dialog_title</item>
    <item name="android:centerDark">@drawable/dialog_body</item>
    <item name="android:bottomDark">@drawable/dialog_footer</item>
    <item name="android:fullBright">@drawable/dialog_body</item>
    <item name="android:centerBright">@drawable/dialog_body</item>
    <item name="android:bottomBright">@drawable/dialog_footer</item>
    <item name="android:bottomMedium">@drawable/dialog_footer</item>
    <item name="android:centerMedium">@drawable/dialog_body</item>
    <item name="android:windowIsFloating">true</item>

</style>

Activity.java:

AlertDialog.Builder ab = new AlertDialog.Builder(new ContextThemeWrapper(OrderSummary.this, R.style.rtg_AlertDialog));
            ab.setTitle("Select a reason");
            String[] reasons = new String[Shared.Reasons_RejectAll.size()];
            for (int i = 0; i < Shared.Reasons_RejectAll.size(); i++) { 
                try {
                    reasons[i] = Shared.Reasons_RejectAll.get(i).Name;
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            ab.setItems(reasons, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    rejectReason = Shared.Reasons_RejectAll.get(which).Name;
                    for (int i = 0; i <= r.ItemList.length; i++){
                        r.ItemList[index].item.get(i).setStatus(eItemStatus.REJECTED);
                        r.ItemList[index].item.get(i).setRejectReason(rejectReason);
                    }
                    adapter.notifyDataSetChanged();
                }
            }) 
            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // No additional code required at this time.
                }
            });
            //ab.show();

            AlertDialog dialog = ab.create();
            dialog.show();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:29:16+00:00Added an answer on May 30, 2026 at 1:29 pm

    Found the answer! From what I’ve researched, the buttons on an alertdialog use their own layout that cannot be overridden, so I ended up subclassing Dialog and building a custom dialog myself.

    CustomDialog.java:

    public class CustomDialog extends Dialog implements OnClickListener {
    TextView tvTitle;
    TextView tvMessage;
    Button btnOK;
    ListView listView;
    Context context;
    ProgressBar prgWait;
    ProgressBar prgBar;
    
    public CustomDialog(Context context) {
        super(context, R.style.rtg_DialogActivity);
        setContentView(R.layout.dialog);
        this.context = context;
    
        // replace the background dim with a background blur effect
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.dimAmount = 0.0f;
        getWindow().setAttributes(lp);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    
        tvTitle = (TextView) findViewById(R.id.tvDialogTitle);
        tvMessage = (TextView) findViewById(R.id.tvDialogMessage);
        btnOK = (Button) findViewById(R.id.btnDialog);
        listView = (ListView) findViewById(R.id.lvDialogList);
        prgWait = (ProgressBar) findViewById(R.id.prgDialog);
        prgBar = (ProgressBar) findViewById(R.id.prgDialogBar);
    }
    
    public CustomDialog setTitle(String text) {
        tvTitle.setText(text);      
        return this;
    }
    
    public CustomDialog setMessage(String text) {
        tvMessage.setVisibility(View.VISIBLE);
        tvMessage.setText(text);        
        return this;
    }
    
    public CustomDialog setList(List<String> list, OnItemClickListener l) {
        ArrayAdapter<String> aa = new ArrayAdapter<String>(this.getContext(), android.R.layout.simple_list_item_1, list);
        listView.setVisibility(View.VISIBLE);
        listView.setAdapter(aa);
        listView.setOnItemClickListener(l);         
        return this;
    }
    
    public CustomDialog setList(String[] list, OnItemClickListener l) {
        List<String> lString = new ArrayList<String>();
        for (String s : list)
            lString.add(s);     
        return setList(lString, l);
    }
    
    public CustomDialog setButton(String text, View.OnClickListener l) {
        btnOK.setText(text);
        btnOK.setOnClickListener(l);
        return this;
    }
    
    public CustomDialog setButton(String text) {
        return setButton(text, this);
    }
    
    public CustomDialog isIndeterminate(boolean b) {
        if (b) {
            prgWait.setVisibility(View.VISIBLE);
            btnOK.setVisibility(View.GONE);
        } else {
            prgWait.setVisibility(View.GONE);
            btnOK.setVisibility(View.VISIBLE);
        }
        return this;
    }
    
    public CustomDialog isProgress(boolean b) {
        if (b) {
            prgBar.setVisibility(View.VISIBLE);
            btnOK.setVisibility(View.GONE);
        } else {
            prgBar.setVisibility(View.GONE);
            btnOK.setVisibility(View.VISIBLE);
        }
        return this;
    }
    
    public CustomDialog setProgressMax(int max) {
        prgBar.setMax(max);
        return this;
    }
    
    public CustomDialog setProgress(int progress) {
        prgBar.setProgress(progress);
        return this;
    }
    
    public int getProgressMax() {
        return prgBar.getMax();
    }
    
    public int getProgress() {
        return prgBar.getProgress();
    }
    
    @Override
    public void onClick(View v) {
        this.dismiss();
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've tracked down a weird MySQL problem to the two different ways I was
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.