File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
lib/java/com/google/android/material/button Expand file tree Collapse file tree 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) {
245245 adjustChildMarginsAndUpdateLayout ();
246246 }
247247
248- private void recoverAllChildrenLayoutParams (){
248+ private void recoverAllChildrenLayoutParams () {
249249 for (int i = 0 ; i < getChildCount (); i ++) {
250250 MaterialButton child = getChildButton (i );
251251 child .recoverOriginalLayoutParams ();
@@ -408,6 +408,14 @@ private void adjustChildMarginsAndUpdateLayout() {
408408 int smallestStrokeWidth = 0 ;
409409 if (spacing <= 0 ) {
410410 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 );
411419 }
412420
413421 LayoutParams params = buildLayoutParams (currentButton );
Original file line number Diff line number Diff line change @@ -522,9 +522,6 @@ private void setupButtonChild(@NonNull MaterialButton buttonChild) {
522522 buttonChild .setEllipsize (TruncateAt .END );
523523 buttonChild .setCheckable (true );
524524 buttonChild .setA11yClassName (getChildrenA11yClassName ());
525-
526- // Enables surface layer drawing for semi-opaque strokes
527- buttonChild .setShouldDrawSurfaceColorStroke (true );
528525 }
529526
530527 void onButtonCheckedStateChanged (@ NonNull MaterialButton button , boolean isChecked ) {
You can’t perform that action at this time.
0 commit comments