Ionic - Android version - alerts are way too big

I built an android version of my ionic 2 app, and when I create alerts on my app using AlertController, even when there is so little text in the alert box, it takes up the whole screen and there’s lots of blank white wasted space in the alert. Is there a way to make my android alerts more size proportionate w.r.t the text like how it is in iOS ?

An image of how the alert looks :

Code :

          let a = this.alertCtrl.create({
          title : "Oops",
          message : "You don't have the key to unlock this chest",
          buttons : [{
             text : "OK",
             role:"OK"}
         ]
        });
          a.present();

@Sidharth_1999 have you solved it?

Yes I have, are you having this issue as well?

Yes i am! Please, what did you?

I added this to my app.scss :

      .button-inner {
           height: 5%; 
      }

It turns out by default, the height of the button was set to a really large value, so I reduced it to 5%. I overrided the entire .button-inner class in app.scss, but I guess you can just override the height property.

In my opinion, this is something ionic should have done themselves in main.css. I don’t know what they were thinking making the height of the android buttons 100%

Hope this solves your issue.

Sidharth

Many thanks!
It solve my problem!

1 Like

I’m glad it does :slight_smile:

1 Like