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:
John Spurlock
2014-06-20 10:53:54 -04:00
parent 1e2f374e71
commit e599488968

View File

@@ -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,