Skip to content
This repository was archived by the owner on Oct 23, 2020. It is now read-only.

Commit dfaac1d

Browse files
author
Dmytro Tarianyk
committed
Fixed changing Lable\'s background programmatically.
1 parent ad11d7b commit dfaac1d

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

library/src/main/java/com/github/clans/fab/FloatingActionButton.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.github.clans.fab;
22

3-
import android.animation.LayoutTransition;
43
import android.annotation.TargetApi;
54
import android.content.Context;
65
import android.content.res.ColorStateList;
@@ -32,7 +31,6 @@
3231
import android.view.View;
3332
import android.view.ViewGroup;
3433
import android.view.ViewOutlineProvider;
35-
import android.view.ViewParent;
3634
import android.view.animation.Animation;
3735
import android.view.animation.AnimationUtils;
3836
import android.widget.ImageButton;
@@ -1300,8 +1298,16 @@ public void showButtonInMenu(boolean animate) {
13001298
* Set the label's background colors
13011299
*/
13021300
public void setLabelColors(int colorNormal, int colorPressed, int colorRipple) {
1303-
getLabelView().setColors(colorNormal, colorPressed, colorRipple);
1304-
getLabelView().updateBackground();
1301+
Label label = getLabelView();
1302+
1303+
int left = label.getPaddingLeft();
1304+
int top = label.getPaddingTop();
1305+
int right = label.getPaddingRight();
1306+
int bottom = label.getPaddingBottom();
1307+
1308+
label.setColors(colorNormal, colorPressed, colorRipple);
1309+
label.updateBackground();
1310+
label.setPadding(left, top, right, bottom);
13051311
}
13061312

13071313
public void setLabelTextColor(int color) {

0 commit comments

Comments
 (0)