您好,欢迎来到伴沃教育。
搜索
您的当前位置:首页更改 support 包 AlertDialog Button

更改 support 包 AlertDialog Button

来源:伴沃教育
Button positionButton = mDialog.getButton(AlertDialog.BUTTON_POSITIVE);
            positionButton.setTextColor(ContextCompat.getColor(NewPaymentActivity.this, R.color.red_tips));
            Button negativeButton = mDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
            negativeButton.setTextColor(ContextCompat.getColor(NewPaymentActivity.this, R.color.gray9));

或者

    <!-- 自定义Dialog显示风格 -->
    <style name="AlertDialogCustom" parent="Theme.AppCompat.Light.Dialog.Alert">
        <!-- NeutralButtonStyle -->
        <item name="buttonBarNeutralButtonStyle">@style/buttonBarNeutral</item>
        <!-- NegativeButtonStyle -->
        <item name="buttonBarNegativeButtonStyle">@style/buttonBarNegative</item>
        <!-- PositiveButtonStyle -->
        <item name="colorAccent">@color/colorPrimary</item>
    </style>

    <style name="buttonBarNegative" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">@color/black3</item>
    </style>

    <style name="buttonBarPositive" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">@color/colorPrimary</item>
    </style>

    <style name="buttonBarNeutral" parent="@style/Widget.AppCompat.Button.ButtonBar.AlertDialog">
        <item name="android:textColor">@color/black3</item>
    </style>


 <style name="AppThemeCompat" parent="Theme.AppCompat.Light">
      
        <item name="alertDialogTheme">@style/AlertDialogCustom</item>
    </style>

Copyright © 2019- bangwoyixia.com 版权所有 湘ICP备2023022004号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务