diff --git a/ChangeLog.md b/ChangeLog.md index fbef7cee..042dc341 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,8 @@ # 更新日志 -- 优化选择器设置标题设置,避免设置不生效问题; +## 4.0.1 - 2021.09.26 + +- 优化选择器标题设置,避免设置不生效问题; ## 4.0.0 - 2021.09.18 diff --git a/Common/src/main/java/com/github/gzuliyujiang/dialog/ModalDialog.java b/Common/src/main/java/com/github/gzuliyujiang/dialog/ModalDialog.java index 47ba3844..fd0a0d68 100644 --- a/Common/src/main/java/com/github/gzuliyujiang/dialog/ModalDialog.java +++ b/Common/src/main/java/com/github/gzuliyujiang/dialog/ModalDialog.java @@ -214,6 +214,24 @@ private void maybeBuildEllipseButton() { } } + @Override + public void setTitle(@Nullable CharSequence title) { + if (titleView != null) { + titleView.setText(title); + } else { + super.setTitle(title); + } + } + + @Override + public void setTitle(int titleId) { + if (titleView != null) { + titleView.setText(titleId); + } else { + super.setTitle(titleId); + } + } + @CallSuper @Override public void onClick(View v) { diff --git a/README.md b/README.md index 9d36f04d..6c18120d 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,7 @@ data.add(new GoodsCategoryBean(4, "医疗保健")); data.add(new GoodsCategoryBean(5, "酒水饮料")); data.add(new GoodsCategoryBean(6, "图书音像")); OptionPicker picker = new OptionPicker(this); +picker.setTitle("货物分类"); picker.setBodyWidth(140); picker.getWheelView().setIndicatorColor(0xFFFF0000); picker.getWheelView().setTextColor(0xFFFF00FF); @@ -202,33 +203,49 @@ picker.show(); ### 在 XML 中 ```xml - ``` ```xml - - - - + + + ... ``` -### 定制样式 +### 自定义样式 #### 全局配置所有选择器样式及配色 @@ -251,7 +268,6 @@ public class DemoApp extends Application { #### 在`app/.../res/values/styles.xml`中重写`WheelDefault`覆盖 ```xml -