Android v21 Theme.Appcompat color accent is ignored, no padding on dialogs

后端 未结 3 966
-上瘾入骨i
-上瘾入骨i 2020-11-30 23:48

I\'m using ActionBarActivity from the Android 5 SDK and here is my theme.xml for v21


About the dialog. AppCompat doesn't support it (as I know).
You can try to use this style in your values-v21 folder:




UPDATE 23/04/2015: SUPPORT LIBRARY V.22.1

The new support library v22.1 works with the Dialog. You can use an android.support.v7.app.AlertDialog or the new AppCompatDialog.

For example:

import android.support.v7.app.AlertDialog

AlertDialog.Builder builder =
       new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle);
            builder.setTitle("Dialog");
            builder.setMessage("Lorem ipsum dolor ....");
            builder.setPositiveButton("OK", null);
            builder.setNegativeButton("Cancel", null);
            builder.show();

And use a style like this:


Otherwise you can define in your current theme:


and then in your code:

 import android.support.v7.app.AlertDialog

    AlertDialog.Builder builder =
           new AlertDialog.Builder(this);

提交回复
热议问题