android - How to prevent AlertDialog using custom theme from appearing fullscreen?


Question: 

I am using a custom style for my AlertDialogs, but it is making them appear fullscreen. I've searched around, but I could only seem to find people wanting to make it fullscreen...

Here is my style

<style name="MyDialog" parent="AlertDialog.AppCompat">
    <item name="android:background">@color/material_dark</item>
    <item name="android:layout_height">100dp</item>
    <item name="android:textColor">@color/accent</item>
    <item name="android:textColorPrimary">@color/material_white</item>
</style>  

And one of my AlertDialogs.

AlertDialog alertDialog = new AlertDialog.Builder(this.getContext(), R.style.MyDialog)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setTitle(this.getContext().getResources().getString(R.string.reset) + "?")
            .setMessage(this.getContext().getResources().getString(R.string.AreYouSure))
            .setPositiveButton(getString(R.string.yes), (dialog, which) -> {
                reset();
            })
            .setNegativeButton(getString(R.string.notReally), (dialog, which) ->{
                //Do nothing
            })
            .show();

And this is what it looks like. I cannot figure out why it takes up the entire screen. It should look like an AlertDialog just with custom colors.

enter image description here




1 Answer: 

add <item name="android:windowIsFloating">true</item> to MyDialog style
 

More Articles


r - select certain elements to build incrementally ioslides

I'm building a presentation using ioslides in RStudio. I have a following slide:```{r, echo=FALSE}logo<-"logo.jpg"```## Playing with R<IMG style="position:absolute;top:5.5%;right:5%;width:140px;"SRC="`r logo`">Type in the interactive console:```{r, eval=FALSE}x <- 1:10 # "name <- valu

android - MediaRouter connect second time

I am using Android's MediaRouter / Presentation API (the support.v7 version).Everything works fine so far. The only thing that doesn't is:When I quit my activity (e.g.teardown & remove the callbacks), everything still works fine. However, when starting this activity (the previous mediarouter-act

r - Start with highlight mode enabled in ioslides

In ioslides presentation with Rmarkdown, there is an option to enable highlight mode in each slide by pressing h. Is there some way to make the highlight mode enabled by default and disable it by pressing h.


r - How can I incrementally build a plot in an ioslide presentation using Rmarkdown?

I'm trying to build a plot incrementally on one slide using Rmarkdown to create an ioslides (HTML) presentation. I've tried using {.build} but to no avail, and it seems there is no documentation on this in the Rmarkdown community. Does anyone know how to write this code in R?Here is a MWE where I tr

c# - XAML Layout- how to add a WebKitBrowser below buttons inside a <Grid>

I have the following XAML markup, which I am trying to use to display a WebKitBrowser below some buttons on the the GUI of my application:<DockPanel VerticalAlignment="Stretch" Height="Auto" HorizontalAlignment="Stretch" Width="Auto"> <Grid x:Name="browserGrid">

objective c - iOS Project Structure for Presentation App

I'm gonna build presentation app, which will present a brandproduct.Presentation will have multiple slides (states) with commonbackground.In some slides I can go back to previous slideMy questions: 1. Do I have to use View Based Application? 2. For each state (slide) should I use separate UIViewCont


r - Embed javascript in Xaringan presentation

I have an interactive pooling question created using polleverywhere that would like to insert into my Xaringan rmarkdown presentation:<script src="https://www.polleverywhere.com/multiple_choice_polls/U43TXrlame7hw6J/web.js?height=250&results_count_format=percent&width=300"></script&

r - How to Make RStudio Presentation Self-contained?

I'm writing a presentation in R using RStudio. To create new presentation, I select "R Presentation" from the File => New File menu. RStudio creates new document. Here is the template:New Presentation========================================================author: date: First Slide===================

ios - Error: Attempt to present <UIImagePickerController: on <ViewController: while a presentation is in progress

Hey everyone and thank you for reading. I am making an app which you can take pictures and retreive pictures from the camera roll and display it on a view. The problem is that when I try to use the button which brings up the camera roll, I get the error "presentation is in progress" as above in the

git - replaying code for a hands on code presentation

So I need to conduct a workshop where I will be coding live on stage to build a demo app while the audience may follow.First problem is my typing speed is slow and secondly we have a fixed time span in which to complete the presentation.I have seen some youtube videos where presenters will use some