File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
library/src/main/java/com/hjq/shape/builder Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -673,6 +673,8 @@ public ShapeDrawableBuilder setLineGravity(int gravity) {
673673 }
674674
675675 public Drawable buildBackgroundDrawable () {
676+ Drawable viewBackground = mView .getBackground ();
677+
676678 boolean hasSolidColorState = mSolidPressedColor != null || mSolidCheckedColor != null ||
677679 mSolidDisabledColor != null || mSolidFocusedColor != null || mSolidSelectedColor != null ;
678680
@@ -681,13 +683,13 @@ public Drawable buildBackgroundDrawable() {
681683
682684 if (!isSolidGradientColorsEnable () && !isStrokeGradientColorsEnable () &&
683685 mSolidColor == NO_COLOR && !hasSolidColorState && mStrokeColor == NO_COLOR && !hasStrokeColorState ) {
684- // 啥都没有设置,直接 return
685- return null ;
686+ // 如果什么属性都没有设置,直接返回原先 View 的背景
687+ // Github issue 地址:https://github.com/getActivity/ShapeView/issues/104
688+ return viewBackground ;
686689 }
687690
688691 ShapeDrawable defaultDrawable ;
689692
690- Drawable viewBackground = mView .getBackground ();
691693 if (viewBackground instanceof ExtendStateListDrawable ) {
692694 defaultDrawable = convertShapeDrawable (((ExtendStateListDrawable ) viewBackground ).getDefaultDrawable ());
693695 } else {
You can’t perform that action at this time.
0 commit comments