Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

AppCompatActivity has changed my AlertDialog design

DimChrisDimChris USMember ✭✭✭✭

I have change my activity to appCompat Activity.
Also i changed AlertDialog to Android.Support.V7.App.AlertDialog.
But i have lost my previous alertdialog design.
This is how it was look like.

And this is how it looks now

My theme till now was

parent="@android:style/Theme.Holo.Light.DarkActionBar">

But i was enforced to changed it cause appCompat doesn't support Holo theme.
So i change it to

 parent="Theme.AppCompat.Light.DarkActionBar">

How can i make alert dialog look like previous one?

Best Answer

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Different themes will offer different designs of dialog. The first image you post is the style of android:Theme.Holo.Light.DarkActionBar if you changed it to Theme.AppCompat.Light.DarkActionBar and consumed an AppCompatActivity the design will definitely change to the second screenshot.
    If you do want a uniform appearance you'd better customize your own dialog:
    https://medium.com/@daRochaPires/custom-dialog-in-xamarin-android-8388e518b1d0

  • DimChrisDimChris USMember ✭✭✭✭

    Thank you LandLu. I found this example

    AlertDialog dialog= new AlertDialog.Builder(new ContextThemeWrapper(context, android.R.style.Theme_Holo_Dialog));
    

    But it also is obsolete : deprecated.
    I will go for my own dialog i just wonder if there is somethign similar to it

Sign In or Register to comment.