diff --git a/library/build.gradle b/library/build.gradle index ea6b666..711f9f7 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -6,8 +6,8 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 31 - versionCode 37 - versionName "support.v0.0.13" + versionCode 38 + versionName "support.v0.0.14" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/library/src/main/java/com/ruffian/library/widget/helper/RBaseHelper.java b/library/src/main/java/com/ruffian/library/widget/helper/RBaseHelper.java index bf76699..e636f42 100644 --- a/library/src/main/java/com/ruffian/library/widget/helper/RBaseHelper.java +++ b/library/src/main/java/com/ruffian/library/widget/helper/RBaseHelper.java @@ -373,27 +373,27 @@ private void setupDefaultValue(boolean init) { if (mBackgroundColorNormalArray != null && mBackgroundColorNormalArray.length > 0) { mBackgroundNormal = setColors(mBackgroundNormal, mBackgroundColorNormalArray); } else { - mBackgroundNormal.setColor(mBackgroundColorNormal); + mBackgroundNormal = setColors(mBackgroundNormal, new int[]{mBackgroundColorNormal, mBackgroundColorNormal}); } if (mBackgroundColorPressedArray != null && mBackgroundColorPressedArray.length > 0) { mBackgroundPressed = setColors(mBackgroundPressed, mBackgroundColorPressedArray); } else { - mBackgroundPressed.setColor(mBackgroundColorPressed); + mBackgroundPressed = setColors(mBackgroundPressed, new int[]{mBackgroundColorPressed, mBackgroundColorPressed}); } if (mBackgroundColorUnableArray != null && mBackgroundColorUnableArray.length > 0) { mBackgroundUnable = setColors(mBackgroundUnable, mBackgroundColorUnableArray); } else { - mBackgroundUnable.setColor(mBackgroundColorUnable); + mBackgroundUnable = setColors(mBackgroundUnable, new int[]{mBackgroundColorUnable, mBackgroundColorUnable}); } if (mBackgroundColorCheckedArray != null && mBackgroundColorCheckedArray.length > 0) { mBackgroundChecked = setColors(mBackgroundChecked, mBackgroundColorCheckedArray); } else { - mBackgroundChecked.setColor(mBackgroundColorChecked); + mBackgroundChecked = setColors(mBackgroundChecked, new int[]{mBackgroundColorChecked, mBackgroundColorChecked}); } if (mBackgroundColorSelectedArray != null && mBackgroundColorSelectedArray.length > 0) { mBackgroundSelected = setColors(mBackgroundSelected, mBackgroundColorSelectedArray); } else { - mBackgroundSelected.setColor(mBackgroundColorSelected); + mBackgroundSelected = setColors(mBackgroundSelected, new int[]{mBackgroundColorSelected, mBackgroundColorSelected}); } //设置边框默认值 diff --git a/library/src/main/java/com/ruffian/library/widget/helper/RTextViewHelper.java b/library/src/main/java/com/ruffian/library/widget/helper/RTextViewHelper.java index e6122cd..dcc08d2 100644 --- a/library/src/main/java/com/ruffian/library/widget/helper/RTextViewHelper.java +++ b/library/src/main/java/com/ruffian/library/widget/helper/RTextViewHelper.java @@ -883,6 +883,7 @@ private void setSingleIconWithText() { if (translateX < 0) translateX = 0; //垂直方向计算 float textHeight = TextViewUtils.get().getTextHeight(mView, drawableHeight, mPaddingTop, mPaddingBottom, drawablePaddingVertical); + textHeight = Math.max(textHeight, Math.max(mIconHeightLeft, mIconHeightRight));//交叉轴存在icon时高度重新计算 float bodyHeight = textHeight + drawableHeight + drawablePaddingVertical;//内容高度 float actualHeight = mView.getHeight() - (mPaddingTop + mPaddingBottom);//实际可用高度 int translateY = (int) (actualHeight - bodyHeight) / 2; @@ -931,6 +932,7 @@ private void setMultipleIconWithText() { if (translateX < 0) translateX = 0; //垂直方向计算 float textHeight = TextViewUtils.get().getTextHeight(mView, drawableHeightFinal, mPaddingTop, mPaddingBottom, drawablePaddingVerticalFinal); + textHeight = Math.max(textHeight, Math.max(mIconHeightLeft, mIconHeightRight));//交叉轴存在icon时高度重新计算 float bodyHeight = textHeight + drawableHeightFinal + drawablePaddingVerticalFinal;//内容高度 float actualHeight = mView.getHeight() - (mPaddingTop + mPaddingBottom);//实际可用高度 int translateY = (int) (actualHeight - bodyHeight) / 2;