最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android?MaterialAlertDialogBuilder修改按鈕屬性

 更新時(shí)間:2022年11月17日 15:09:01   作者:九狼  
這篇文章主要介紹了Android?MaterialAlertDialogBuilder修改按鈕屬性實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

編寫按鈕屬性

首先再values/themes 或者values/style在文件下編寫按鈕屬性

buttonBarPositiveButtonStyle對(duì)應(yīng)著確認(rèn)按鈕

buttonBarNegativeButtonStyle對(duì)應(yīng)著取消按鈕

<style name="AlertDialogTheme">
    <item name="buttonBarPositiveButtonStyle">@style/Alert.Button.Positive</item>
    <item name="buttonBarNegativeButtonStyle">@style/Alert.Button.Negative</item>
</style>
<style name="Alert.Button.Positive" parent="Widget.MaterialComponents.Button.TextButton">
    <item name="backgroundTint">@color/colorPrimary</item>
    <item name="rippleColor">@color/colorAccent</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textSize">14sp</item>
    <item name="android:textAllCaps">false</item>
    <item name="android:layout_marginStart">3dp</item>
</style>
<style name="Alert.Button.Negative" parent="Widget.MaterialComponents.Button.TextButton">
    <item name="backgroundTint">@color/colorPrimary</item>
    <item name="rippleColor">@color/colorAccent</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="android:textSize">14sp</item>
</style>

Dialog 風(fēng)格設(shè)置

為Dialog設(shè)置風(fēng)格 new MaterialAlertDialogBuilder(getContext(), R.style.AlertDialogTheme)

AlertDialog.Builder alertDialogBuilder = new MaterialAlertDialogBuilder(getContext(), R.style.AlertDialogTheme)
        .setTitle("添加設(shè)備")
        .setPositiveButton(
                "確定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                            }
                        });
                    }
                })
        .setNegativeButton("取消", null);
alertDialogBuilder.show();

效果圖

buttonBarPositiveButtonStyle對(duì)應(yīng)著確認(rèn)按鈕

以上就是Android MaterialAlertDialogBuilder 修改按鈕屬性的詳細(xì)內(nèi)容,更多關(guān)于Android MaterialAlertDialogBuilder的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評(píng)論

鲁山县| 磴口县| 晋城| 贵港市| 乌拉特后旗| 夏津县| 常德市| 霞浦县| 星子县| 汤原县| 来安县| 大连市| 焉耆| 溧水县| 科技| 县级市| 台北市| 双桥区| 宁城县| 新源县| 鄄城县| 岢岚县| 贵定县| 南平市| 渭源县| 旬邑县| 丽水市| 威远县| 响水县| 宣威市| 新巴尔虎右旗| 桦甸市| 广东省| 乌拉特后旗| 道孚县| 扎赉特旗| 布尔津县| 郓城县| 绵竹市| 威远县| 平遥县|