Skip to content

Commit

Permalink
We can't use FloatingActionButton#setUseCompatPadding due an issue i…
Browse files Browse the repository at this point in the history
…n Lollipop. For pre Lollipop we don't need margin.
  • Loading branch information
andremion committed Feb 3, 2019
1 parent aeff013 commit 50220de
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ public CounterFab(Context context, AttributeSet attrs) {
public CounterFab(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);

setUseCompatPadding(true);

float density = getResources().getDisplayMetrics().density;
mTextSize = TEXT_SIZE_DP * density;
float textPadding = TEXT_PADDING_DP * density;
Expand Down
5 changes: 5 additions & 0 deletions sample/src/main/res/values-v21/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<resources>
<!--We can't use FloatingActionButton#setUseCompatPadding due an issue in Lollipop.-->
<!--Use this margin only for API 21+-->
<dimen name="fab_margin">16dp</dimen>
</resources>
4 changes: 3 additions & 1 deletion sample/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="fab_margin">16dp</dimen>
<!--We can't use FloatingActionButton#setUseCompatPadding due an issue in Lollipop.-->
<!--For pre Lollipop we don't need margin-->
<dimen name="fab_margin">0dp</dimen>
</resources>

0 comments on commit 50220de

Please sign in to comment.