File tree 2 files changed +9
-4
lines changed
lib/java/com/google/android/material/button
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ public void onViewRemoved(View child) {
245
245
adjustChildMarginsAndUpdateLayout ();
246
246
}
247
247
248
- private void recoverAllChildrenLayoutParams (){
248
+ private void recoverAllChildrenLayoutParams () {
249
249
for (int i = 0 ; i < getChildCount (); i ++) {
250
250
MaterialButton child = getChildButton (i );
251
251
child .recoverOriginalLayoutParams ();
@@ -408,6 +408,14 @@ private void adjustChildMarginsAndUpdateLayout() {
408
408
int smallestStrokeWidth = 0 ;
409
409
if (spacing <= 0 ) {
410
410
smallestStrokeWidth = min (currentButton .getStrokeWidth (), previousButton .getStrokeWidth ());
411
+ // Enables the flag to draw additional layer of surface color under the stroke, which may
412
+ // overlap with its neighbors and results unintended color when the stroke color is
413
+ // semi-transparent.
414
+ currentButton .setShouldDrawSurfaceColorStroke (true );
415
+ previousButton .setShouldDrawSurfaceColorStroke (true );
416
+ } else {
417
+ currentButton .setShouldDrawSurfaceColorStroke (false );
418
+ previousButton .setShouldDrawSurfaceColorStroke (false );
411
419
}
412
420
413
421
LayoutParams params = buildLayoutParams (currentButton );
Original file line number Diff line number Diff line change @@ -522,9 +522,6 @@ private void setupButtonChild(@NonNull MaterialButton buttonChild) {
522
522
buttonChild .setEllipsize (TruncateAt .END );
523
523
buttonChild .setCheckable (true );
524
524
buttonChild .setA11yClassName (getChildrenA11yClassName ());
525
-
526
- // Enables surface layer drawing for semi-opaque strokes
527
- buttonChild .setShouldDrawSurfaceColorStroke (true );
528
525
}
529
526
530
527
void onButtonCheckedStateChanged (@ NonNull MaterialButton button , boolean isChecked ) {
You can’t perform that action at this time.
0 commit comments