Skip to content

Commit 3789a33

Browse files
authored
Update README.md
1 parent 247da13 commit 3789a33

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,22 @@ API level>=17,允许js 被调用的函数必须以@JavascriptInterface 进行
641641
642642
```
643643

644+
* 如何动态修改AlertDialog的Button样式,
645+
```
646+
//监听Dialog的setOnShowListener方法
647+
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
648+
@Override
649+
public void onShow(final DialogInterface dialog) {
650+
Button negativeButton = ((AlertDialog)dialog).getButton(DialogInterface.BUTTON_NEGATIVE);
651+
Button positiveButton = ((AlertDialog)dialog).getButton(DialogInterface.BUTTON_POSITIVE);
652+
negativeButton.invalidate();
653+
positiveButton.invalidate();
654+
}
655+
});
656+
dialog.show();
657+
658+
```
659+
644660

645661

646662
#### 摘自[如下地址](https://github.com/jiang111/awesome-android-tips/blob/master/Authors.md)

0 commit comments

Comments
 (0)