If we're not showing switch text, don't include in measure.
Naive fix for switch crashes when !showText. Bug:15770311 Change-Id: I68839b61b907d62159e2c12349005683e9ac6436
This commit is contained in:
@@ -570,8 +570,8 @@ public class Switch extends CompoundButton {
|
||||
|
||||
mTrackDrawable.getPadding(mTempRect);
|
||||
|
||||
final int maxTextWidth = Math.max(mOnLayout.getWidth(), mOffLayout.getWidth())
|
||||
+ mThumbTextPadding * 2;
|
||||
final int maxTextWidth = mShowText ? Math.max(mOnLayout.getWidth(), mOffLayout.getWidth())
|
||||
+ mThumbTextPadding * 2 : 0;
|
||||
mThumbWidth = Math.max(maxTextWidth, mThumbDrawable.getIntrinsicWidth());
|
||||
|
||||
final int switchWidth = Math.max(mSwitchMinWidth,
|
||||
|
||||
Reference in New Issue
Block a user