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

Android?MaterialAlertDialogBuilder修改按鈕屬性

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

編寫按鈕屬性

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

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

buttonBarNegativeButtonStyle對應(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對應(yīng)著確認(rèn)按鈕

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

相關(guān)文章

最新評論

昂仁县| 阿坝县| 唐山市| 元阳县| 于田县| 运城市| 韶关市| 三亚市| 衡阳市| 寿宁县| 平罗县| 张家界市| 汉川市| 连南| 盐亭县| 偏关县| 济源市| 化德县| 即墨市| 泸水县| 阳城县| 蒙山县| 东丽区| 瑞昌市| 麻栗坡县| 康马县| 大关县| 辽中县| 开封市| 昭苏县| 太原市| 西乌珠穆沁旗| 措勤县| 新邵县| 峡江县| 星子县| 神池县| 广元市| 太仓市| 攀枝花市| 阿拉尔市|