0

I'm making an app where an AlertDialog is needed. When the dialog opens, it looks like a Jellybean alert dialog, but when I paste the code in another project it looks like a Lollipop alert dialog. Why? (I'm making the dialog using AlertDialog.Builder solution; said in case another solution exists. Also, I'm programming with AIDE development environment and I have Lollipop OS installed on the device.)

Hardy Android
  • 855
  • 9
  • 20
hadizadeh.ali
  • 63
  • 1
  • 8
  • 1
    just change your application compile level. if compileSdkVersion 23 then it's working fine for all the version's of Android. – Hardy Android May 05 '16 at 10:27

3 Answers3

0

make custom alert dialog

check this reference:

How to create a Custom Dialog box in android?

Community
  • 1
  • 1
Damini Mehra
  • 3,257
  • 3
  • 13
  • 24
0

if use AppCompact style

you can add this line to it

<item name="alertDialogTheme">@style/AppCompatAlertDialogStyle</item>

and in your code import android.support.v7.app.AlertDialog

AlertDialog.Builder builder =
       new AlertDialog.Builder(this);
androidAhmed
  • 227
  • 1
  • 4
  • 16
0

setContentView property can use your custom layout

Dialog dialog = new Dialog(this);
dialog.setContentView(R.layout.custom_dialog_layout);
Masum
  • 4,879
  • 2
  • 23
  • 28