Skip to content

Commit

Permalink
fix(android): prevent unnecessary requestLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
iPel authored and zealotchen0 committed Aug 7, 2023
1 parent d1b313c commit 1c7d630
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -733,14 +733,15 @@ private void resetBackgroundDrawable() {
if (mRippleDrawable != null) {
drawableList.add(mRippleDrawable);
}
super.setBackground(null);
if (drawableList.size() > 0) {
Drawable[] drawables = new Drawable[drawableList.size()];
for (int i = 0; i < drawableList.size(); i++) {
drawables[i] = drawableList.get(i);
}
LayerDrawable layerDrawable = new LayerDrawable(drawables);
super.setBackground(layerDrawable);
} else {
super.setBackground(null);
}
}
}

0 comments on commit 1c7d630

Please sign in to comment.