Reputation: 191
I am trying to create alert dialog to look like this
But I can't figure out why, when I launch app on my device I get dialog looking like this:
I followed many tutorials and still got alert dialog looking like that. Code is pretty standard so I am not gonna post it, but if required I will. My device is running on 4.3 android. My question: Does alert style change with device API Lvl? If so what can I do to create Dialog like on first pic? I would create custom dialog with layout inflater, but I want to have those cool buttons.
Upvotes: 1
Views: 671
Reputation: 2153
The issue is with Themes.
The Dialog from the first screenshot uses the "Holo Light" theme, while the second one uses the "Theme" theme.
You have two options for creating an AlertDialog like the one in the first picture.
You can change the theme for your application or activity to inherit from Holo.Light (see Android's Styles & Themes guide). This will change the appearance of AlertDialogs across the entire application or activity.
You can set the theme for an individual AlertDialog in the following manner:
new AlertDialog.Builder(new ContextThemeWrapper(this, android.R.style.Theme_Holo_Light_Dialog))
.setTitle("Demo Dialog")
.setMessage("This AlertDialog uses the theme android.R.style.Theme_Holo_Light_Dialog.")
.create()
.show();
Either of these options will produce the following result:
Upvotes: 3
Reputation: 2934
You should create custom dialog box in android.
http://www.mkyong.com/android/android-custom-dialog-example/
Upvotes: 0