1

I have one application in which I have alert dialogue used for page navigation. It's working fine all other API...in Android 7.1.1 it's working but not showing button text. I have tried to use style also as located answer here

Missing buttons on AlertDialog | Android 7.0 (Nexus 5x)

but I am not success to solve the puzzle. My dialogue java code is like below

 private void showGotoPageDialog(){

        if(mTotalPages>0){

            AlertDialog.Builder builder = new AlertDialog.Builder(
                    getActivity(),R.style.AlertDialogTheme);
            builder.setTitle("Quick Navigation To:");
            builder.setSingleChoiceItems(mPageOptions,mPageIndx-1,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,
                                            int item) {
                            mIsDialogDismissed=true;
                            mOptionDiag.dismiss();

                            SlideInDownAnimator animator = new SlideInDownAnimator();
                            animator.setInterpolator(new OvershootInterpolator());
                            animator.setAddDuration(500);
                            animator.setRemoveDuration(500);
                            mQuoteList.setItemAnimator(animator);

                            mPageIndx=item+1;
                            updateQuotesList();
                            updatePageInfo();
                        }
                    });

            builder.setNegativeButton("Dismiss",
                    new DialogInterface.OnClickListener() {

                        public void onClick(DialogInterface dialog,
                                            int id) {

                            // action on dialog close
                        }

                    });
            mOptionDiag= builder.create();
            mOptionDiag.show();
        }

    }

and my style is like below

<style name="AppBaseTheme" parent="android:Theme.Light">
  <item name="alertDialogTheme">@style/AlertDialogTheme</item>
    </style>


 <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
  <!-- Customize your theme here. -->
  <item name="colorPrimary">@color/colorPrimary</item>
  <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
  <item name="colorAccent">@color/colorAccent</item>
  <item name="windowActionBar">true</item>
  <item name="alertDialogTheme">@style/AlertDialogTheme</item>
 </style>

 <style name="AlertDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
  <item name="colorPrimary">@color/colorPrimary</item>
  <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
  <item name="colorAccent">@color/colorAccent</item>
  <item name="buttonBarButtonStyle">@style/DialogButtonStyle</item>
 </style>
 <style name="DialogButtonStyle" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
  <item name="android:textColor">@color/colorPrimary</item>
 </style>

Please check and let me know if someone have similar issue and solved it. Thanks

0 Answers0