mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
Parameterize FAB's maxImageSize.
PiperOrigin-RevId: 168774497
This commit is contained in:
parent
40e788f9fd
commit
a53014baeb
@ -81,6 +81,8 @@
|
||||
<attr name="borderWidth" format="dimension"/>
|
||||
<!-- Enable compat padding. -->
|
||||
<attr name="useCompatPadding" format="boolean"/>
|
||||
<!-- Maximum icon image size. -->
|
||||
<attr name="maxImageSize" format="dimension"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="FloatingActionButton_Behavior_Layout">
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
<item name="pressedTranslationZ">@dimen/design_fab_translation_z_pressed</item>
|
||||
<item name="rippleColor">?attr/colorControlHighlight</item>
|
||||
<item name="borderWidth">@dimen/design_fab_border_width</item>
|
||||
<item name="maxImageSize">@dimen/design_fab_image_size</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Design.ScrimInsetsFrameLayout" parent="">
|
||||
|
||||
@ -177,6 +177,7 @@ public class FloatingActionButton extends VisibilityAwareImageButton
|
||||
final float pressedTranslationZ =
|
||||
a.getDimension(R.styleable.FloatingActionButton_pressedTranslationZ, 0f);
|
||||
mCompatPadding = a.getBoolean(R.styleable.FloatingActionButton_useCompatPadding, false);
|
||||
mMaxImageSize = a.getDimensionPixelSize(R.styleable.FloatingActionButton_maxImageSize, 0);
|
||||
a.recycle();
|
||||
|
||||
mImageHelper = new AppCompatImageHelper(this);
|
||||
@ -184,8 +185,6 @@ public class FloatingActionButton extends VisibilityAwareImageButton
|
||||
|
||||
expandableWidgetHelper = new ExpandableWidgetHelper(this);
|
||||
|
||||
mMaxImageSize = (int) getResources().getDimension(R.dimen.design_fab_image_size);
|
||||
|
||||
getImpl()
|
||||
.setBackgroundDrawable(mBackgroundTint, mBackgroundTintMode, mRippleColor, mBorderWidth);
|
||||
getImpl().setElevation(elevation);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user