欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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)文章

  • iOS UIButton 點(diǎn)擊無(wú)響應(yīng)的解決辦法

    iOS UIButton 點(diǎn)擊無(wú)響應(yīng)的解決辦法

    在開發(fā)中按鈕我們經(jīng)常會(huì)遇到,但是有時(shí)候會(huì)碰到一些難以處理的問(wèn)題,就是按鈕點(diǎn)擊無(wú)響應(yīng),其實(shí)解決方法也不難。下面小編之家小編抽空給大家介紹iOS UIButton 點(diǎn)擊無(wú)響應(yīng)的解決辦法,需要的朋友參考下吧
    2017-12-12
  • Android使用Walle實(shí)現(xiàn)多渠道打包功能的實(shí)現(xiàn)示例

    Android使用Walle實(shí)現(xiàn)多渠道打包功能的實(shí)現(xiàn)示例

    這篇文章主要介紹了Android使用Walle實(shí)現(xiàn)多渠道打包功能的實(shí)現(xiàn)示例,幫助大家更好的理解和學(xué)習(xí)使用Android開發(fā),感興趣的朋友可以了解下
    2021-04-04
  • Android自帶倒計(jì)時(shí)控件Chronometer使用方法詳解

    Android自帶倒計(jì)時(shí)控件Chronometer使用方法詳解

    這篇文章主要為大家詳細(xì)介紹了Android自帶倒計(jì)時(shí)控件Chronometer的使用方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-11-11
  • Android中使用GridView實(shí)現(xiàn)仿微信圖片上傳功能(附源代碼)

    Android中使用GridView實(shí)現(xiàn)仿微信圖片上傳功能(附源代碼)

    由于工作要求最近在使用GridView完成圖片的批量上傳功能,我的例子當(dāng)中包含仿微信圖片上傳、拍照、本地選擇、相片裁剪等功能,如果有需要的朋友可以看一下
    2017-08-08
  • 修改Android Studio 的 Logcat 緩沖區(qū)大小操作

    修改Android Studio 的 Logcat 緩沖區(qū)大小操作

    這篇文章主要介紹了修改Android Studio 的 Logcat 緩沖區(qū)大小操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-04-04
  • Kotlin利用Regex如何構(gòu)建正則表達(dá)式詳解

    Kotlin利用Regex如何構(gòu)建正則表達(dá)式詳解

    正則表達(dá)式,又稱規(guī)則表達(dá)式。下面這篇文章主要給大家介紹了關(guān)于Kotlin利用Regex構(gòu)建正則表達(dá)式的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起看看吧。
    2017-12-12
  • Android 中Fragment與Activity通訊的詳解

    Android 中Fragment與Activity通訊的詳解

    這篇文章主要介紹了Android 中Fragment與Activity通訊的詳解的相關(guān)資料,希望通過(guò)本文能幫助到大家,讓大家理解掌握如何通信的,需要的朋友可以參考下
    2017-10-10
  • Android編程中自定義dialog用法實(shí)例

    Android編程中自定義dialog用法實(shí)例

    這篇文章主要介紹了Android編程中自定義dialog用法,結(jié)合實(shí)例形式較為詳細(xì)的分析了Android自定義dialog的定義.布局及調(diào)用等相關(guān)技巧,需要的朋友可以參考下
    2015-12-12
  • Android自定義view繪制圓環(huán)占比動(dòng)畫

    Android自定義view繪制圓環(huán)占比動(dòng)畫

    這篇文章主要為大家詳細(xì)介紹了Android自定義view繪制圓環(huán)占比動(dòng)畫,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-01-01
  • Android ScrollView使用代碼示例

    Android ScrollView使用代碼示例

    這篇文章主要介紹了Android ScrollView使用代碼示例,本文直接給出示例代碼,需要的朋友可以參考下
    2015-05-05

最新評(píng)論