views:

62

answers:

2

So I see we can have alertdialogs with gray and white (when setinverse...) background colors.

To learn why I checked themes.xml of the sdk, checking it I was led to drawables and there I realized the alertdialog background is not done programatically but via some images. And these images guarantee that there are two gray(or white when inverse color) horizontal lines on top(title area) and bottom(just above button area) of the dialog when we use LayoutInflater to just set a different backgroundcolor.

So my question is, as LayoutInflator is useless and guessing I have to subclass alertdialog, what do you suggest I do to generate an AlertDialog with a different backgroundcolor? What should I override?

+1  A: 

I'm not completely sure as I'm a serious beginner. That said, I recall reading that not all Android Dialogs are created equally. Therefore, if you don't want to use the dialog that shipped with the device's Android version; You need to code a completely fresh dialog from the ground up.

Edit:

I think you need to override the onCreateDialog with a custom dialog builder class. Like I said, I've never done it. Remember, to keep with the Android MVC style, you need to define the dialog in XML as well. If I was going to do it; I would probably start with the XML layout, then code a custom dialog class using the same methods as a regular dialog builder class. Sorry to be so vague, I'm still learning Java and Android myself.

Martinez
+1 Thx for the answer. So what methods should I override to get a functional custom dialog?
ahmet emrah