Skip to content

Commit

Permalink
Fix zcweng#1, crash on Android 4.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
msdx committed Mar 16, 2017
1 parent 4da96d5 commit 8484322
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions library/src/main/java/com/suke/widget/SwitchButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ public SwitchButton(Context context, AttributeSet attrs, int defStyleAttr, int d

@Override
public final void setPadding(int left, int top, int right, int bottom) {
//do nothing
throw new RuntimeException("illegal call : method [setPadding]");
super.setPadding(0, 0, 0, 0);
}

/**
Expand Down Expand Up @@ -186,7 +185,7 @@ private void init(Context context, AttributeSet attrs) {
valueAnimator.addListener(animatorListener);

super.setClickable(true);
super.setPadding(0,0,0,0);
this.setPadding(0, 0, 0, 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
Expand Down

0 comments on commit 8484322

Please sign in to comment.